//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); } } }
//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); } } }
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); }