Example #1
0
 //Renders the tiles.
 public void Render(Camera camera)
 {
     foreach (Tile tile in Tiles)
     {
         //Only render the ones that are in the camera bounds
         if (CollisionHandler.CollidesWith
                 (camera, tile, Tile.SPRITE_WIDTH, Tile.SPRITE_HEIGHT))
         {
             tile.Render(camera.X, camera.Y);
         }
     }
 }
Example #2
0
 //Renders the bullets
 public void Render(Camera camera)
 {
     foreach (Bullet bullet in bullets)
     {
         //Only render the ones that are in the camera bounds
         if (CollisionHandler.CollidesWith
                 (camera, bullet, Bullet.SPRITE_WIDTH, Bullet.SPRITE_HEIGHT))
         {
             bullet.Render(camera);
         }
     }
 }
 //Renders the players
 public void Render(Camera camera)
 {
     foreach (KeyValuePair <int, ServerPlayer> player in players)
     {
         //Render only the ones that are in the camera bounds
         if (CollisionHandler.CollidesWith
                 (camera, player.Value, Player.SPRITE_WIDTH,
                 Player.SPRITE_HEIGHT))
         {
             player.Value.Render(camera);
         }
     }
 }
Example #4
0
    public bool CheckCollisions(Hitbox[] hitboxes, float centerX, float centerY)
    {
        foreach (Hitbox hitbox in hitboxes)
        {
            if (CollisionHandler.CollidesWith
                    ((int)centerX, (int)centerY, RADIUS, hitbox))
            {
                return(true);
            }
        }

        return(false);
    }