So I am working on an game/app - 2D racing game and I am trying my best at it, but yet I have studied C# for like 1 year. My problem is that I have two images (simple cars) and I can move them with their location via KeyData. It works unless I want both of them to move at once. This is what I move it with =>
protected override bool Move(ref Message msg, Keys KeyData)
{
if (KeyData == Keys.Up)
{
bluePoint.Y -= normalSpeed;
Refresh();
return true;
}
if (KeyData == Keys.Down)
{
bluePoint.Y += normalSpeed;
Refresh();
return true;
}
if (KeyData == Keys.Left)
{
bluePoint.X -= normalSpeed;
Refresh();
return true;
}
if (KeyData == Keys.Right)
{
bluePoint.X += normalSpeed;
Refresh();
return true;
}
if (KeyData == Keys.W)
{
redPoint.Y -= normalSpeed;
Refresh();
return true;
}
if (KeyData == Keys.S)
{
redPoint.Y += normalSpeed;
Refresh();
return true;
}
if (KeyData == Keys.A)
{
redPoint.X -= normalSpeed;
Refresh();
return true;
}
if (KeyData == Keys.D)
{
redPoint.X += normalSpeed;
Refresh();
return true;
}
return true;
}