Exemplo n.º 1
0
        public PowerUp(Vector2 spawn, PowerUp.TYPE type)
        {
            this.type = type;
            this.spawn = spawn;

            switch (type)
            {
                case TYPE.big:
                    animation = Animation.createSingleFrameAnimation("player/powerbig", spawn, 1.0f);
                    pULight = new Light(new Color(0.2f, 0.2f, 1f), animation.position, Constants.POWERUPLIGHTPOWER * 2, Constants.POWERUPLIGHTSIZE);
                    break;
                case TYPE.pierce:
                    animation = Animation.createSingleFrameAnimation("player/powerpierce", spawn, 1.0f);
                    pULight = new Light(new Color(1f, 1f, 0.2f), animation.position, Constants.POWERUPLIGHTPOWER * 2, Constants.POWERUPLIGHTSIZE);
                    break;
                case TYPE.shield:
                    animation = Animation.createSingleFrameAnimation("player/powershield", spawn, 1.0f);
                    pULight = new Light(new Color(0.2f, 1f, 0.2f), animation.position, Constants.POWERUPLIGHTPOWER * 2, Constants.POWERUPLIGHTSIZE);
                    break;
                case TYPE.speed:
                    animation = Animation.createSingleFrameAnimation("player/powerspeed", spawn, 1.0f);
                    pULight = new Light(new Color(1f, 0.2f, 0.2f), animation.position, Constants.POWERUPLIGHTPOWER * 2, Constants.POWERUPLIGHTSIZE);
                    break;
            }

            this.activeTime = Constants.POWERUPTIMER;
            this.respawnTimer = Constants.POWERUPRESPAWN;

            animation.setScale(Constants.POWERUPSCALE);
        }
Exemplo n.º 2
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);
        }