Beispiel #1
0
        public Snake(Keys[] keys, Color color, Game game, Player player)
        {
            // Params
            this.color = color;
            this.keys = keys;

            this.game = game;
            this.player = player;

            // Defaults
            this.speed = Game.snakeDefaultSpeed;
            this.turningSpeed = Game.snakeDefaultTurningSpeed;
            this.size = Game.snakeDefaultSize;

            this.isDrawing = true;
            this.inverse = 1;
            this.crashed = false;

            this.isNotDrowingUntil = DateTime.Now;

            // Pen
            RecreateTrailingPen();

            // Poweups
            powerups = new List<Powerup>();
            penGreen = new Pen(new SolidBrush(Color.PaleGreen), 4);
            penRed = new Pen(new SolidBrush(Color.PaleVioletRed), 4);
        }
Beispiel #2
0
        Player createPlayer()
        {
            playersCount++;

            Color c = defaultColors.ElementAt(0);
            Keys[] k = defaultKeys.ElementAt(0);
            defaultColors.RemoveAt(0);
            defaultKeys.RemoveAt(0);

            Player p = new Player(c, k, this);
            players.Add(p);
            snakes.Add(p.snake);

            return p;
        }