public TileMap(Level level, int tilesHorz, int tilesVert) { this.tilesHorz = tilesHorz; this.tilesVert = tilesVert; this.level = level; tiles = new Tile[tilesHorz,tilesVert]; for (int i = 0; i < tilesHorz; i++) { for (int j = 0; j < tilesVert; j++) { if (j > tilesVert * 3 / 4 || (i < tilesHorz / 2 && j > tilesVert / 2)) { //tiles[i, j] = new Tile(Static.TILE_NOT_OBSTACLE, i * Static.TILE_WIDTH, j * Static.TILE_HEIGHT, false); tiles[i, j] = new Tile(Static.TILE_OBSTACLE, i * Static.TILE_WIDTH, j * Static.TILE_HEIGHT, true); } else { tiles[i, j] = new Tile(Static.TILE_NOT_OBSTACLE, i * Static.TILE_WIDTH, j * Static.TILE_HEIGHT, false); } } } }
protected override void Initialize() { entities = new List<GameEntity>(); AIs = new List<AI>(); removalQueue = new Queue<GameEntity>(); spawnQueue = new Queue<Spawnable>(); collisions = new HashSet<Collision>(); currLevel = new Level(this); graphics.PreferredBackBufferHeight = Static.SCREEN_HEIGHT; graphics.PreferredBackBufferWidth = Static.SCREEN_WIDTH; this.players = new Player[4]; //just for testing -- makes a rectangle //Texture2D playerRect = new Texture2D(GraphicsDevice, Static.PLAYER_HEIGHT, Static.PLAYER_WIDTH); Texture2D playerRect = Content.Load<Texture2D>("Sprites/player"); Color[] data = new Color[Static.PLAYER_HEIGHT * Static.PLAYER_WIDTH]; for (int i = 0; i < data.Length; ++i) { data[i] = Color.Aquamarine; } //playerRect.SetData(data); //will use real sprites eventually.. players[0] = new Player(this,PlayerIndex.One,playerRect,0,0); Spawn(players[0]); Spawn(new BasicNPC(this, playerRect, 300, 100, 10, 10)); base.Initialize(); }