When i move the mouse, the image associated with it moves as it should, so no problem. But the RotatingFlash(); which is muzzleFlash.Paint(sender, e); is not rotating at all, until i stop moving the mouse. If i'm not moving the mouse, the flash is rotating.
If this is a common bug, please advise me what i'm doing wrong.
I think a solution could be working on threads...but, maybe im overthinking it.
So i want your input first.
What I have tried:
private void canvas_Paint(object sender, PaintEventArgs e)
{
background.Paint(sender, e);
enemy01.Paint(sender, e);
muzzleFlash.Paint(sender, e);
e.Graphics.DrawString("SCORE " + score, new Font("Arial", 10), new SolidBrush(Color.Black), new PointF(10f, 5f));
if (WinScreenOn)
{
e.Graphics.Clear(Color.DarkRed);
e.Graphics.DrawString("You Win", new Font("Arial", 50), new SolidBrush(Color.Black), new PointF(10f, 5f));
e.Graphics.DrawString("Next Level ", new Font("Arial", 10), new SolidBrush(Color.Black), new PointF(100f, 100f));
}
mousetarget.Paint(sender, e);
}
void timer1_Tick(object sender, EventArgs e)
{
RotatingFlash();
Refresh();
}
private void canvas_MouseMove(object sender, MouseEventArgs e)
{
mousetarget.X = e.X; mousetarget.Y = e.Y;
mousetarget.Move(sender, e); Refresh();
}