Exemplo n.º 1
0
        public Player(Vector2[] spawn, int num, GameState gameState)
        {
            this.num = num;
            this.spawn = spawn;
            this.gameState = gameState;
            switch (num)
            {
                case 1:
                    animation = Animation.createSingleFrameAnimation("player/redplayer", spawn[num-1], 0.9f);
                    disk = new Disk(this, "player/reddisk", spawn[num - 1] + new Vector2(0, 20), new Color(0.8f, 0.1f, 0.1f));
                    playerlight = new Light(new Color(1f, 0.2f, 0.2f), animation.position, Constants.PLAYERLIGHTPOWER * 2, Constants.PLAYERLIGHTSIZE);
                    break;
                case 2:
                    animation = Animation.createSingleFrameAnimation("player/yellowplayer", spawn[num - 1], 0.9f);
                    disk = new Disk(this, "player/yellowdisk", spawn[num - 1] + new Vector2(0, 20), new Color(0.8f, 0.8f, 0.1f));
                    playerlight = new Light(new Color(1f, 1f, 0.2f), animation.position, Constants.PLAYERLIGHTPOWER, Constants.PLAYERLIGHTSIZE);
                    break;
                case 3:
                    animation = Animation.createSingleFrameAnimation("player/greenplayer", spawn[num - 1], 0.9f);
                    disk = new Disk(this, "player/greendisk", spawn[num - 1] + new Vector2(0, 20), new Color(0.1f, 0.8f, 0.1f));
                    playerlight = new Light(new Color(0.2f, 1f, 0.2f), animation.position, Constants.PLAYERLIGHTPOWER, Constants.PLAYERLIGHTSIZE);
                    break;
                case 4:
                    animation = Animation.createSingleFrameAnimation("player/blueplayer", spawn[num - 1], 0.9f);
                    disk = new Disk(this, "player/bluedisk", spawn[num - 1] + new Vector2(0, 20), new Color(0.1f, 0.1f, 0.8f));
                    playerlight = new Light(new Color(0.2f, 0.2f, 1f), animation.position, Constants.PLAYERLIGHTPOWER * 2, Constants.PLAYERLIGHTSIZE);
                    break;
            }
            speedPUAnimation = Animation.createSingleFrameAnimation("player/orangepowerup", spawn[num - 1], 0.95f);
            speedPUAnimation.setVisible(false);

            shieldPUAnimation = Animation.createSingleFrameAnimation("player/shieldpu", spawn[num - 1], 1.0f);
            shieldPUAnimation.setVisible(false);
            shieldPUAnimation.setScale(20f);

            animation.setScale(Constants.PLAYERSCALE);
            disk.setScale(Constants.PLAYERSCALE);
            speedPUAnimation.setScale(Constants.PLAYERSCALE);
            shieldPUAnimation.setScale(Constants.PLAYERSCALE);
            powerUps = new List<PowerUp>();
            random = new Random(num);
        }
Exemplo n.º 2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            current = menu = new MenuState(Content);
            game = new GameState(Content);
            replay = new ReplayState(Content);

            current.enterState();
        }