Пример #1
0
 public void collision(GoodCharacter player)
 {
     collisionRight(player);
     collisionLeft(player);
     collisionUp(player);
     collisionDown(player);
 }
Пример #2
0
 public static void collisionRight(GoodCharacter player)
 {
     foreach (Rock tile in Map.collidables)
     {
         if (player.CollBoxLR.Intersects(tile.CollisionBox) && tile.CollisionBox.X > player.Collision.X) {
             player.Speed = tile.CollisionBox.X - (player.Collision.X + player.Collision.Width);
         }
     }
 }
Пример #3
0
 public static void collisionUp(GoodCharacter player)
 {
     foreach (Rock tile in Map.collidables)
     {
         if (player.CollBoxUD.Intersects(tile.CollisionBox) && tile.CollisionBox.Y < player.Collision.Y)
         {
             player.Speed = player.Collision.Y   - (tile.CollisionBox.Y + tile.collisionBox.Height);
         }
     }
 }
Пример #4
0
 public static void collisionLeft(GoodCharacter player)
 {
     foreach (Rock tile in Map.collidables)
     {
         if (player.CollBoxLR.Intersects(tile.CollisionBox) && tile.CollisionBox.X < player.Collision.X)
         {
             //player.Speed =  tile.CollisionBox.X + tile.CollisionBox.Width - player.CollisionBox.X;
             player.Speed = player.Collision.X - (tile.CollisionBox.X  + tile.CollisionBox.Width);
         }
     }
 }
Пример #5
0
 public static void collisionDown(GoodCharacter player)
 {
     foreach (Rock tile in Map.collidables)
     {
         if (player.CollBoxUD.Intersects(tile.CollisionBox) && tile.CollisionBox.Y > player.Collision.Y)
         {
             //player.Speed =  player.CollisionBox.Y + player.CollisionBox.Height - tile.CollisionBox.Y;
            // player.Speed = tile.CollisionBox.Y - tile.CollisionBox.Height /2  - player.CollisionBox.Y ;
             player.Speed = tile.collisionBox.Y - (player.Collision.Y + player.Collision.Height);
         }
     }
 }