Example #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);
        }
Example #2
0
 public Disk(Player p, String name, Vector2 position, Color light)
 {
     player = p;
     animation = Animation.createSingleFrameAnimation(name, position, 0.85f);
     disklight = new Light(light, animation.position, Constants.DISKLIGHTPOWER * 2, Constants.DISKLIGHTSIZE);
     diskVelocity = Constants.DISKVELOCITY;
     diskRadius = Constants.DISKRADIUS;
     diskPierce = false;
 }
Example #3
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);
        }
Example #4
0
 /// <summary>
 /// Removes the given light from the rendering engine
 /// </summary>
 /// <param name="light">The light to remove</param>
 public void removeLight(Light light)
 {
     lights.Remove(light);
 }
Example #5
0
 /// <summary>
 /// Makes sure the provided light exists in RenderingEngine (adds it if not)
 /// </summary>
 /// <param name="anim">the light to be made sure is part of the engine</param>
 public void ensureAdded(Light light)
 {
     if (!lights.Contains(light))
         lights.Add(light);
 }
Example #6
0
 /// <summary>
 /// Adds the given light to the rendering engine, so it can be used in shading
 /// </summary>
 /// <param name="light">The light to add</param>
 public void addLight(Light light)
 {
     lights.Add(light);
 }