What you can do is create separate timers for each movement instance.
For example, for going up, down, right and left, you can create a timer that goes like:
private void up_Tick(object sender, EventArgs e)
{
//this makes the player go up
player.Top -= 3;
}
private void down_Tick(object sender, EventArgs e)
{
//this makes the player go down
player.Top += 3;
}
private void left_Tick(object sender, EventArgs e)
{
//this makes the player go left
player.Left -= 3;
}
private void right_Tick(object sender, EventArgs e)
{
//this makes the player go right
player.Left += 3;
}
After creating the timers, you can create key up and key down events to handle the movement with keys -
private void yourFormName_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.W)
{
\\this starts the timer to go up and if you press the W key then the player goes up
up.Start();
}
if (e.KeyCode == Keys.S)
{
\\this starts the timer to go down and if you press the S key then the player goes down
down.Start();
}
if (e.KeyCode == Keys.D)
{
\\this starts the timer to go right and if you press the D key then the player goes right
right.Start();
}
if (e.KeyCode == Keys.A)
{
\\this starts the timer to go left and if you press the W key then the player goes left
left.Start();
}
}
Hope this helped!