Beispiel #1
0
 private void fireAMissile()
 {
     String caller = "player";
     Missile mymissile = new Missile(caller , game, graphics, spriteBatch);
     mymissile.position = this.position;
     mymissile.forward = this.forward;
     mymissile.up = this.up;
     shouldFireAMissile = false;
 }
Beispiel #2
0
        private void applyPowerUpIfApplicable()
        {
            if (shouldGoFaster == true)
            {
                if (goFasterTimer < 120) // 2 second burst
                {
                    this.accelerationValue = 200; //twice as fast
                }
                else
                {
                    // reset everything
                    shouldGoFaster = false;
                    goFasterTimer = 0;
                    this.accelerationValue = 100;
                }

                goFasterTimer++;
            }

            if (shouldPoison == true)
            {
                if (poisonTimer < 180) // 3 second hit
                {
                    this.accelerationValue = 50; //twice as slow
                }
                else
                {
                    // reset everything
                    shouldPoison = false;
                    poisonTimer = 0;
                    this.accelerationValue = 100;
                }

                poisonTimer++;
            }

            if (shouldFireMissile == true)
            {

                String caller = "cpu";
                Missile mymissile = new Missile(caller, game, graphics, spriteBatch);
                mymissile.position = this.position;
                mymissile.forward = this.forward;
                mymissile.up = this.up;
                shouldFireMissile = false;

            }
        }