thanks for all the input, do you have any more input that is applicable to my collision problem? I am not giving up on my problem, there has to be an answer to it.
c# clearing images
well I finally solved my problem. YEAH!!!!!!!! here is the code I am using.
int count = 102;
bool collision = false;
public void Form1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.Clear(Color.Black);
e.Graphics.DrawImage(ship, 350 + x, 530);
if(collision)
{
return;
}
e.Graphics.DrawImage(bullet, 375 + x, 520 + y);
e.Graphics.DrawImage(bug_one, 350, 0);
if (y <= -510 && x >= -15 && x <= 15 && count > 0)
{
e.Graphics.DrawImage(coll, 350, 0);
count = 0;
collision = true;
}
}
public void timer1_Tick(object sender, EventArgs e)
{
y -= 5;
Invalidate();
}
public void timer2_Tick(object sender, EventArgs e)
{
count--;
Invalidate();
}
Are you in the mood to talk about it? This is good. We have options now...Let's check a few things. How many times do I want to see the coll image? If this event happens late, does it happen at all? What I suggest is walk though your logic for a few frames and see if all the values of your variables are what you think they should be. More importantly are they what you think they should be when they need to be first used. I would keep my head in this and practice with the debugger.
Dev careful. Pixel on board.
Buckle up. Everything will be revealed.
well everything is working like I want it to do. now I have to draw several bugs. you can close this thread since I solved my problem.
9 hours ago, phil67rpg said:do you have any more input that is applicable to my collision problem?
I made something for you. Could you solve this follow problem? Imagine that you have a point and a rectangle. Is the point inside of the rectangle?
My flowchart should help you: https://drakonhub.com/ide/doc/8observer8/14
Are you sure? ⚠️
Dev careful. Pixel on board.
Buckle up. Everything will be revealed.