using System; using System.Collections.Generic; using System.Linq; using System.Text; using VBXSE; namespace SnakeRPG { public class Tile { public enum TilePresets { None = 0, Grass = 4, Path = 5, GrayPath = 14 } public Sprite sprite = null; public Tile() { } public Tile(TilePresets preset, int x, int y, int mapOffsetX = 0, int mapOffsetY = 0) { switch (preset) { case TilePresets.Grass: this.sprite = CreateSprite("grass", x, y, mapOffsetX, mapOffsetY); break; case TilePresets.Path: this.sprite = CreateSprite("path", x, y, mapOffsetX, mapOffsetY); break; case TilePresets.GrayPath: this.sprite = CreateSprite("graypath", x, y, mapOffsetX, mapOffsetY); break; } } private Sprite CreateSprite(string name, int x, int y, int mapOffsetX = 0, int mapOffsetY = 0) { Sprite toReturn = SpriteEngine.CreateSprite(name); toReturn.depth = 20; int bonusX = mapOffsetX * Main.MAP_WIDTH * Main.SPRITE_WIDTH; int bonusY = mapOffsetY * Main.MAP_HEIGHT * Main.SPRITE_HEIGHT; if (bonusX > 0) { int a = 0; a++; } toReturn.SetPosition(Main.SPRITE_WIDTH * x + bonusX, Main.SPRITE_HEIGHT * y + bonusY); return toReturn; } } }