Example #1
0
 private void DrawsChar(Directions dir, MainChar player)
 {
     if (dir == Directions.None)
     {
         dir = lastPlayerDirection;
     }
     if (dir == Directions.Left)
     {
         canvas.DrawImage(charTextureLeft, (float)player.posXGet(), (float)player.posYGet());
         lastPlayerDirection = Directions.Left;
     }
     else if (dir == Directions.Right)
     {
         canvas.DrawImage(charTextureRight, (float)player.posXGet(), (float)player.posYGet());
         lastPlayerDirection = Directions.Right;
     }
     else if (dir == Directions.Up)
     {
         canvas.DrawImage(charTextureBack, (float)player.posXGet(), (float)player.posYGet());
         lastPlayerDirection = Directions.Up;
     }
     else if (dir == Directions.Down)
     {
         canvas.DrawImage(charTextureFront, (float)player.posXGet(), (float)player.posYGet());
         lastPlayerDirection = Directions.Down;
     }
 }
 private bool CheckCollision(MainChar mainChar, Car car)
 {
     if (CheckCollisionPlane(mainChar.posXGet(), MainChar.SIZE_PLAYER_HORIZONTAL, car.posXGet(), Car.HITBOX_X_CAR) &&
         CheckCollisionPlane(mainChar.posYGet(), MainChar.SIZE_PLAYER_VERTICAL, car.posYGet(), Car.HITBOX_Y_CAR))
     {
         return(true);
     }
     return(false);
 }