public GridMap(SnakeLevel currentLevel) { FoodCap = 4; FoodCount = 0; Width = currentLevel.TiledMap.Width; Height = currentLevel.TiledMap.Height; grid.Capacity = Width * Height; for (int x = 0; x < Width; x++) { MapCell xCell = new MapCell(); grid.Add(xCell); for (int y = 0; y < Height; y++) { MapCell yCell = new MapCell(); grid.Add(yCell); } } InitCollisionCells(currentLevel.TiledMap); }
public override void LoadContent() { Intialize(); ContentManager content = ScreenManager.Game.Content; Players.Add(SnakeFactory.CreateFromTemplate("default")); gameFont = ScreenManager.Game.Content.Load<SpriteFont>("gamefont"); scoreFont = ScreenManager.Game.Content.Load<SpriteFont>("scorefont"); //gameBackground = ScreenManager.Game.Content.Load<Texture2D>("sky_bg"); //midGround = ScreenManager.Game.Content.Load<Texture2D>("midground_grasshill"); cherryFood = ScreenManager.Game.Content.Load<Texture2D>("cherry"); bananaFood = ScreenManager.Game.Content.Load<Texture2D>("bananas"); tiledMap = content.Load<Map>(TiledMapName); SnakeHelper.Init(ScreenManager.GraphicsDevice, tiledMap); tiledMap.Offset = SnakeHelper.offset; CurrentLevel = new SnakeLevel(tiledMap); //GridMap needs to be last due to reliance on Map and SnakeLevel map = new GridMap(CurrentLevel); }