Beispiel #1
0
 public void ControlPlayerPositionOnMovableObject(PictureBox movableObject, PictureBox player, int speed, Direction.Way direction)
 {
     if (checkClass.IsPlayerOnMovableObject(player, movableObject))
     {
         //srodek
         if ((movableObject.Left <= player.Left) && (movableObject.Right >= player.Right))
         {
             if (direction == Direction.Way.Left)
             {
                 leftDirectionController.MoveRowLeft(player, speed);
             }
             if (direction == Direction.Way.Right)
             {
                 rightDirectionController.MoveRowRight(player, speed);
             }
         }
         //lewy
         if ((movableObject.Left > player.Left) && (movableObject.Right > player.Right))
         {   // speed bo jest skok obiektu ruchomego o speed
             player.Left = movableObject.Left - speed;
         }
         //prawy
         if ((movableObject.Left < player.Left) && (movableObject.Right < player.Right))
         {
             player.Left = movableObject.Right - player.Width;
         }
     }
 }
Beispiel #2
0
 private void TimerRow2_Tick(object sender, EventArgs e)
 {
     leftDirectionController.MoveRowLeft(movableObjectRow1No1, gameSetup.GameSpeed);
     leftDirectionController.MoveRowLeft(movableObjectRow1No2, gameSetup.GameSpeed);
     leftDirectionController.MoveRowLeft(movableObjectRow1No3, gameSetup.GameSpeed);
     leftDirectionController.MoveRowLeft(movableObjectRow1No4, gameSetup.GameSpeed);
 }