public SnakePlayer BuildSnake()
        {
            SnakePlayer player = new SnakePlayer(ScreenManager);
            player.Speed = 50f;
            player.Direction = SnakeDirection.Down;
            player.PreviousDirection = SnakeDirection.Down;
            player.Name = "Default";
            player.Head = new SnakeHead(new Point(5, 5));
            player.Head.Texture = Content.Load<Texture2D>("snakehead");
            player.Head.Source = player.Head.Texture.Bounds;
            player.Body = new SnakeBody();
            player.Body.Texture = Content.Load<Texture2D>("snakeblock");
            player.Body.Source = player.Body.Texture.Bounds;

            for (int i = 0; i < 5; i++)
            {
                player.AddSnakeBlock();
            }

            return player;
        }
Esempio n. 2
0
 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++;
 }