Ejemplo n.º 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;
         }
     }
 }
Ejemplo n.º 2
0
 private void TimerRow1_Tick(object sender, EventArgs e)
 {
     rightDirectionController.MoveRowRight(movableObjectRow0No1, gameSetup.GameSpeed);
     rightDirectionController.MoveRowRight(movableObjectRow0No2, gameSetup.GameSpeed);
     rightDirectionController.MoveRowRight(movableObjectRow0No3, gameSetup.GameSpeed);
 }