public void DrawBase(SpriteBatch spriteBatch, ScriptableMap map, int x, int y) { if (texture == null) return; var sourceRect = new Rectangle(0, texture.Height - map.TileSize, map.TileSize, map.TileSize); var destRect = new Rectangle(x + xPos * map.TileSize, y + yPos * map.TileSize, map.TileSize, map.TileSize); spriteBatch.Draw(texture, destRect, sourceRect, Color.White); }
public HUD(Game game, Player player, ScriptableMap map) { font = game.Content.Load<SpriteFont>("hud-font"); background = new Texture2D(game.GraphicsDevice, 1, 1); background.SetData<Color>(new Color[] { new Color(100, 100, 100) }); this.player = player; this.map = map; screenSize = game.GraphicsDevice.Viewport.Height; }
public void DrawTop(SpriteBatch spriteBatch, ScriptableMap map, int x, int y) { if (texture == null) return; int renderX = x + xPos * map.TileSize; int renderY = y + yPos * map.TileSize - (texture.Height - map.TileSize); var sourceRect = new Rectangle(0, 0, map.TileSize, texture.Height - map.TileSize); var destRect = new Rectangle(renderX, renderY, map.TileSize, texture.Height - map.TileSize); spriteBatch.Draw(texture, destRect, sourceRect, Color.White); }
public void Interact(Player player, ScriptableMap map) { var thread = new Thread(new ParameterizedThreadStart(interact)); thread.Start(player); }