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); }
private void PickupFood(SnakePlayer player, MapCell currentCell) { particleSys.CreatePlayerExplosion(SnakeHelper.MapToScreen( player.Head.Position, ScreenManager.Game.Content.Load<Texture2D>("smoke"), ScreenManager.Game.GraphicsDevice)); player.Score += currentCell.Pickup.PointsValue; player.AddSnakeBlock(); player.Speed += 5; currentCell.Pickup = null; currentCell.ContainsPickup = false; map.FoodCount--; player.TotalFoodCollected++; }