Yeah, I'm just about to have my evening meal as well.
However, it's a bit rushed but here's something for you to work on. Sam will probably be able to come up with something better later today.
Notice that as this currently stands, you have to keep the shift key pressed down to move the ship within the dock as well as to enter it.
I'm assuming you're happy with the mouse interface as it stands, because you'd need 3 hands to hold do the shift and arrow keys whilst moving the mouse:
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
// move object up
if (e.KeyCode == Keys.Up)
{
ship.Y = ship.Y - 5;
if (ship.IntersectsWith(dock) && !e.Shift)
{
ship.Y = ship.Y + 5;
MessageBox.Show("You cant enter or move within the object, shift key and arrow key must be pressed simultaneously");
return;
}
this.Refresh();
}
//move object down
else if (e.KeyCode == Keys.Down)
{
ship.Y = ship.Y + 5;
if (ship.IntersectsWith(dock) && !e.Shift)
{
ship.Y = ship.Y - 5;
MessageBox.Show("You cant enter or move within the object, shift key and arrow key must be pressed simultaneously");
return;
}
this.Refresh();
}
// move oboject left
else if (e.KeyCode == Keys.Left)
{
ship.X = ship.X - 5;
if (ship.IntersectsWith(dock) && !e.Shift)
{
ship.Y = ship.X - 5;
MessageBox.Show("You cant enter the object, shift key and arrow key must be pressed simultaneously");
return;
}
this.Refresh();
}
//move object right
else if (e.KeyCode == Keys.Right)
{
ship.X = ship.X + 5;
if (ship.IntersectsWith(dock) && !e.Shift)
{
ship.Y = ship.X - 5;
MessageBox.Show("You cant enter the object, shift key and arrow key must be pressed simultaneously");
return;
}
this.Refresh();
}
}