I am able to draw my space ship and a an enemy (called "bug_one" in the code below) and move my bullet. When the bullet hits the enemy, it draws a collision bmp.
But currently my code draws both the collision bmp and the enemy bmp after the enemy got hit.
What I want instead is that after the bullet hits the enemy, to no longer draw the enemy bmp and draw the collision bmp instead. I'd like also the collision bmp to disappear after some time. here is my reworked code
bool draw_flag_coll = false;
private void Form1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.Clear(Color.Black);
e.Graphics.DrawImage(ship, 350 + x, 530);
e.Graphics.DrawImage(bullet, 375 + x, 520 + y);
e.Graphics.DrawImage(bug_one, 350, 0);
if(draw_flag_coll==true)
{
e.Graphics.DrawImage(coll, 350, 0);
}
}
int count = 0;
private void timer2_Tick(object sender, EventArgs e)
{
if (y <= -510 && x >= -15 && x <= 15)
{
draw_flag_coll = true;
count++;
if(count == 100)
{
this.Invalidate(true);
count = 0;
}
}
}