public override void Update(MainGame game, EntityContainer parent, GameTime time) { foreach (Entity item in this.Items) { item.Update(game, this, time); } }
public override void Draw(MainGame game, EntityContainer parent) { foreach (Entity item in this.Items) { item.Draw(game, this); } }
public Tileset(MainGame game, string imageName, int tileWidth, int tileHeight) { this._tilesetImage = game.GetTexture(imageName); this.TileWidth = tileWidth; this.TileHeight = tileHeight; this.Width = this._tilesetImage.Width / tileWidth; this.Height = this._tilesetImage.Height / tileHeight; }
public void DrawTile(MainGame game, int x, int y, int index) { if (index == 0) { return; } Rectangle rect = new Rectangle(x * this.TileWidth, y * this.TileHeight, this.TileWidth, this.TileHeight); game.DrawImage(_tilesetImage, rect, GetTileRect(index), Color.White); }
private void DoMove(MainGame game, float x, float y) { if (Physics.Colides(MoveSimulate(x,y), this)) { return; } Move(x, y); game.MoveCamera(x, y); }
public void Draw(MainGame game, int x, int y) { atmosTile.Draw(game, x, y); for (int i = 0; i < maxTile; i++) { if (tiles.ContainsKey(i)) { tiles[i].Draw(game, x, y); } } }
public override void Update(MainGame game, EntityContainer parent, GameTime time) { if (game.IsKeyDown(Keys.W) || game.IsKeyDown(Keys.Up)) { DoMove(game, 0, (float)time.ElapsedGameTime.Milliseconds / 5); } if (game.IsKeyDown(Keys.S) || game.IsKeyDown(Keys.Down)) { DoMove(game, 0, -(float)time.ElapsedGameTime.Milliseconds / 5); } if (game.IsKeyDown(Keys.A) || game.IsKeyDown(Keys.Left)) { DoMove(game, (float)time.ElapsedGameTime.Milliseconds / 5, 0); } if (game.IsKeyDown(Keys.D) || game.IsKeyDown(Keys.Right)) { DoMove(game, -(float)time.ElapsedGameTime.Milliseconds / 5, 0); } }
public override void Draw(MainGame game, EntityContainer parent) { game.DrawImage("player", new Rectangle(MainGame.WindowWidth / 2 - 8, MainGame.WindowHeight / 2 - 8, LivingEntSize, LivingEntSize), true); }
public virtual void Draw(MainGame game, int x, int y) { if (this.NoDraw) { return; } game.DrawImage(new Rectangle(x * SSMap.TileSize, y * SSMap.TileSize, SSMap.TileSize, SSMap.TileSize), this.DisplayColor); }
public virtual void Update(MainGame game, GameTime time) { }
public override void Update(MainGame game, EntityContainer parent, GameTime time) { Rectangle seenBounds = game.CameraBounds; for (int x = seenBounds.X / TileSize; x < (seenBounds.X + seenBounds.Width) / TileSize + 2; x++) { for (int y = seenBounds.Y / TileSize; y < (seenBounds.Y + seenBounds.Height) / TileSize + 1 + 2; y++) { if (x >= Width || x < 0 || y >= Height || y < 0) { continue; } Map[x, y].Update(game, time); } } }
public void Update(MainGame game, GameTime time) { atmosTile.Update(game, time); }
public virtual void Update(MainGame game, EntityContainer parent, GameTime time) { }
public virtual void Draw(MainGame game, EntityContainer parent) { }
public override void Draw(MainGame game, int x, int y) { tileSet.DrawTile(game, x, y, tileIndex); }