Beispiel #1
0
 public Inventory(TankGame game)
     : base(game)
 {
     heavyShot       = 1;
     scatterShot     = 1;
     missileDropShot = 1;
 }
Beispiel #2
0
 static void Main(string[] args)
 {
     using (TankGame game = new TankGame())
     {
         game.Run();
     }
 }
Beispiel #3
0
 public PowerUp(TankGame game, Vector2 pos, String type)
     : base(game)
 {
     this.game = game;
     this.powerUpPosition = pos;
     powerUpPic = Game.Content.Load<Texture2D>(@type);
 }
Beispiel #4
0
 public PowerUp(TankGame game, Vector2 pos, String type)
     : base(game)
 {
     this.game            = game;
     this.powerUpPosition = pos;
     powerUpPic           = Game.Content.Load <Texture2D>(@type);
 }
Beispiel #5
0
 public StartScreen(TankGame game, String type)
     : base(game)
 {
     blink      = true;
     spriteFont = Game.Content.Load <SpriteFont>(@type);
     addToTitleList();
 }
Beispiel #6
0
        public bool scanTarget()
        {
            detectionCircle = new Circle(position, sensorDistance);

            if (TankGame.CircleRectangleIntersection(detectionCircle, tankCollisionRectangle))
            {
                missile = new Missile(game, new Vector2(tankPosition.X + missileOffset));
                Game.Components.Add(missile);

                target = new TargetLocked(game, new Vector2(tankPosition.X + tankSize.X / 2, tankPosition.Y + tankSize.Y / 2));
                target.AutoInitialize(game.GraphicsDevice, game.Content, TankGame.spriteBatch);

                target.UpdateOrder = 100;
                target.DrawOrder   = 100;
                target.Visible     = true;

                targetLockedOn = true;
            }
            else
            {
                targetLockedOn = false;
            }

            bulletCollided();

            return(targetLockedOn);
        }
Beispiel #7
0
 public DetectionWheel(TankGame cGame, Vector2 newPosition, string detectionWheel, float rotationSpeed)
     : base(cGame)
 {
     position            = new Vector3(newPosition.X, newPosition.Y, 0);
     this.detectionWheel = detectionWheel;
     this.rotationSpeed  = rotationSpeed;
 }
Beispiel #8
0
 public DetectionWheel(TankGame cGame, Vector2 newPosition, string detectionWheel, float rotationSpeed)
     : base(cGame)
 {
     position = new Vector3(newPosition.X, newPosition.Y, 0);
     this.detectionWheel = detectionWheel;
     this.rotationSpeed = rotationSpeed;
 }
Beispiel #9
0
        public override void InitializeParticleProperties(DefaultSpriteParticle cParticle)
        {
            cParticle.Lifetime = DPSFHelper.RandomNumberBetween(.5f, 1);

            cParticle.Position = Emitter.PositionData.Position;

            float randomVelocity = DPSFHelper.RandomNumberBetween(-200, 200);

            currentRotation += (float)Math.PI / 20;
            Vector2 rotatedRandomVector = TankGame.rotateVector(new Vector2(randomVelocity, randomVelocity), currentRotation);

            cParticle.Velocity = new Vector3(rotatedRandomVector.X, rotatedRandomVector.Y, 0);

            cParticle.Width  = DPSFHelper.RandomNumberBetween(2, 6);
            cParticle.Height = DPSFHelper.RandomNumberBetween(2, 12);

            cParticle.Rotation = currentRotation;

            //Vector3 sVelocityMin = new Vector3(-100, 25, -100);
            //Vector3 sVelocityMax = new Vector3(100, 50, 100);
            //cParticle.Velocity = DPSFHelper.RandomVectorBetweenTwoVectors(sVelocityMin, sVelocityMax);

            //cParticle.Velocity = Vector3.Transform(cParticle.Velocity, Emitter.OrientationData.Orientation);

            cParticle.StartColor = startColor;
            cParticle.EndColor   = endColor;
        }
Beispiel #10
0
 public StartScreen(TankGame game, String type)
     : base(game)
 {
     blink = true;
     spriteFont = Game.Content.Load<SpriteFont>(@type);
     addToTitleList();
 }
Beispiel #11
0
 public Inventory(TankGame game)
     : base(game)
 {
     heavyShot = 1;
     scatterShot = 1;
     missileDropShot = 1;
 }
Beispiel #12
0
 public SmokeCloud(TankGame cGame, Vector2 newPosition, int maxParticles, int particlesPerSecond, Color cloudColor)
     : base(cGame)
 {
     position                = new Vector3(newPosition.X, newPosition.Y, 0);
     this.maxParticles       = maxParticles;
     this.particlesPerSecond = particlesPerSecond;
     this.cloudColor         = cloudColor;
 }
Beispiel #13
0
        public void UpdateParticleVelocity(DPSFDefaultBaseParticle cParticle, float fElapsedTimeInSeconds)
        {
            currentRotation += (float)Math.PI / 4;

            Vector2 rotatedRandomVector = TankGame.rotateVector(originalVector, currentRotation);

            cParticle.Velocity = new Vector3(rotatedRandomVector.X * 800, rotatedRandomVector.Y * 800, 0);
        }
Beispiel #14
0
 public SmokeCloud(TankGame cGame, Vector2 newPosition, int maxParticles, int particlesPerSecond, Color cloudColor)
     : base(cGame)
 {
     position = new Vector3(newPosition.X, newPosition.Y, 0);
     this.maxParticles = maxParticles;
     this.particlesPerSecond = particlesPerSecond;
     this.cloudColor = cloudColor;
 }
Beispiel #15
0
 public Puff(TankGame cGame, Vector2 newPosition, Vector2 newDirection, float power)
     : base(cGame)
 {
     position = new Vector3(newPosition.X, newPosition.Y, 0);
     direction = new Vector3(newDirection.X, newDirection.Y, 0);
     this.power = power;
     maxParticles = (int)power;
 }
Beispiel #16
0
 public Spark(TankGame cGame, Vector2 position, int maxParticles, float lifeTime)
     : base(cGame)
 {
     offsetX           = DPSFHelper.RandomNumberBetween(-20, 20);
     offsetY           = DPSFHelper.RandomNumberBetween(-20, 20);
     this.position     = new Vector3(position.X + offsetX, position.Y + offsetY, 0);
     this.maxParticles = maxParticles;
     this.lifeTime     = lifeTime;
 }
Beispiel #17
0
 public Spark(TankGame cGame, Vector2 position, int maxParticles, float lifeTime)
     : base(cGame)
 {
     offsetX = DPSFHelper.RandomNumberBetween(-20, 20);
     offsetY = DPSFHelper.RandomNumberBetween(-20, 20);
     this.position = new Vector3(position.X + offsetX, position.Y + offsetY, 0);
     this.maxParticles = maxParticles;
     this.lifeTime = lifeTime;
 }
Beispiel #18
0
        public Bullet(TankGame game, Vector2 bulletPosition)
            : base(game)
        {
            this.position = bulletPosition;
            this.type     = BulletType.BasicBullet;

            damage = 50;
            mass   = 1.0f;

            angle = 0;
            speed = Vector2.Zero;
        }
Beispiel #19
0
        public Shots(TankGame game, Vector2 bulletPosition, Vector2 scatterDirection)
            : base(game)
        {
            this.position = bulletPosition;
            this.type = BulletType.ScatterShot;
            
            damage = 20;
            mass = .75f;

            angle = 0;
            speed = scatterDirection;
        }
Beispiel #20
0
        public Bullet(TankGame game, Vector2 bulletPosition)
            : base(game)
        {
            this.position = bulletPosition;
            this.type = BulletType.BasicBullet;

            damage = 50;
            mass = 1.0f;

            angle = 0;
            speed = Vector2.Zero;
        }
Beispiel #21
0
        public HeavyShot(TankGame game, Vector2 bulletPosition)
            : base(game)
        {
            this.position = bulletPosition;
            this.type = BulletType.HeavyShot;

            damage = 75;
            mass = 2.0f;

            angle = 0;
            speed = Vector2.Zero;
        }
Beispiel #22
0
        public Shots(TankGame game, Vector2 bulletPosition, Vector2 scatterDirection)
            : base(game)
        {
            this.position = bulletPosition;
            this.type     = BulletType.ScatterShot;

            damage = 20;
            mass   = .75f;

            angle = 0;
            speed = scatterDirection;
        }
Beispiel #23
0
        public HeavyShot(TankGame game, Vector2 bulletPosition)
            : base(game)
        {
            this.position = bulletPosition;
            this.type     = BulletType.HeavyShot;

            damage = 75;
            mass   = 2.0f;

            angle = 0;
            speed = Vector2.Zero;
        }
Beispiel #24
0
        public Missle(TankGame game, Vector2 bulletPosition)
            : base(game)
        {
            this.position = new Vector2(bulletPosition.X, 0);

            this.type = BulletType.Missile;

            damage = 60;
            mass   = 1.0f;

            angle = 0;
            speed = Vector2.Zero;
        }
Beispiel #25
0
        public Missle(TankGame game, Vector2 bulletPosition)
            : base(game)
        {
            this.position = new Vector2(bulletPosition.X, 0);

            this.type = BulletType.Missile;

            damage = 60;
            mass = 1.0f;

            angle = 0;
            speed = Vector2.Zero;
        }
Beispiel #26
0
        public MissleDrop(TankGame game, Vector2 bulletPosition)
            : base(game)
        {
            Bullet basic = new Bullet(game); 

            this.position = bulletPosition;
            this.type = BulletType.MissileDrop;

            damage = 20;
            mass = 1.0f;

            angle = 0;
            speed = Vector2.Zero;
        }
Beispiel #27
0
        public MissleDrop(TankGame game, Vector2 bulletPosition)
            : base(game)
        {
            Bullet basic = new Bullet(game);

            this.position = bulletPosition;
            this.type     = BulletType.MissileDrop;

            damage = 20;
            mass   = 1.0f;

            angle = 0;
            speed = Vector2.Zero;
        }
Beispiel #28
0
        public MissileDrop(TankGame game, Vector2 bulletPosition)
            : base(game)
        {
            this.game = game;

            this.position = bulletPosition;
            this.type     = BulletType.MissileDrop;

            damage = 10;
            mass   = 1.0f;

            angle = 0;
            speed = Vector2.Zero;

            detect = new List <DetectionWheel>();
        }
Beispiel #29
0
        public MissileDrop(TankGame game, Vector2 bulletPosition)
            : base(game)
        {
            this.game = game;

            this.position = bulletPosition;
            this.type = BulletType.MissileDrop;

            damage = 10;
            mass = 1.0f;

            angle = 0;
            speed = Vector2.Zero;

            detect = new List<DetectionWheel>();
        }
Beispiel #30
0
        public TeleportShot(TankGame game, Vector2 bulletPosition)
            : base(game)
        {
            this.position = bulletPosition;
            this.type     = BulletType.TeleportShot;

            damage = 10;
            mass   = 1.0f;

            angle = 0;
            speed = Vector2.Zero;

            trail = new TeleportTrail(game, this.position);
            trail.AutoInitialize(game.GraphicsDevice, game.Content, TankGame.spriteBatch);

            trail.UpdateOrder = 100;
            trail.DrawOrder   = 100;
            trail.Visible     = true;
        }
Beispiel #31
0
        public TeleportShot(TankGame game, Vector2 bulletPosition)
            : base(game)
        {
            this.position = bulletPosition;
            this.type = BulletType.TeleportShot;

            damage = 10;
            mass = 1.0f;

            angle = 0;
            speed = Vector2.Zero;

            trail = new TeleportTrail(game, this.position);
            trail.AutoInitialize(game.GraphicsDevice, game.Content, TankGame.spriteBatch);

            trail.UpdateOrder = 100;
            trail.DrawOrder = 100;
            trail.Visible = true;
        }
Beispiel #32
0
        public override void InitializeParticleProperties(DefaultSpriteParticle cParticle)
        {
            cParticle.Lifetime = DPSFHelper.RandomNumberBetween(.1f, lifeTime / 2);

            cParticle.Position = Emitter.PositionData.Position;

            currentRotation += (float)Math.PI / 10;
            Vector2 rotatedRandomVector = TankGame.rotateVector(originalVector, currentRotation);

            cParticle.Velocity = new Vector3(rotatedRandomVector.X * 60, rotatedRandomVector.Y * 60, 0);

            cParticle.Size = DPSFHelper.RandomNumberBetween(1, 4);

            cParticle.Rotation = currentRotation;

            cParticle.StartColor = Color.Yellow;
            cParticle.EndColor   = Color.Red;

            cParticle.Friction = DPSFHelper.RandomNumberBetween(50, 200);
        }
Beispiel #33
0
        public ScatterShot(TankGame game, Vector2 bulletPosition)
            : base(game)
        {
            Bullet basic = new Bullet(game);

            this.position = bulletPosition;
            this.type = BulletType.ScatterShot;

            angle = 0;

            scatterAngle = 0;

            damage = 20;
            mass = .75f;

            bulletDirection = new Vector2(1, 0);

            speed = Vector2.Zero;

            scatterShots = new List<Shots>();
        }
Beispiel #34
0
        public Tank(TankGame game, Vector2 tankPosition, float turretAngle)
            : base(game)
        {
            this.game               = game;
            this.tankPosition       = tankPosition;
            turretPosition          = new Vector2(tankPosition.X + 40, tankPosition.Y + 25);
            this.turretAngle        = turretAngle;
            health                  = 200;
            turnTime                = 0;
            moveLimit               = 0;
            originalTurretDirection = new Vector2(0, 1);
            turretDirection         = new Vector2((float)(Math.Cos(-turretAngle) * originalTurretDirection.X - Math.Sin(-turretAngle) * originalTurretDirection.Y),
                                                  (float)(Math.Sin(-turretAngle) * originalTurretDirection.X + Math.Cos(-turretAngle) * originalTurretDirection.Y));
            bullet       = new Bullet(game);
            type         = BulletType.BasicBullet;
            inventory    = new Inventory(game);
            damageClouds = null;
            timer        = 0.0f;

            currentTankState = TankState.Normal;
        }
Beispiel #35
0
        public ScatterShot(TankGame game, Vector2 bulletPosition)
            : base(game)
        {
            Bullet basic = new Bullet(game);

            this.position = bulletPosition;
            this.type     = BulletType.ScatterShot;

            angle = 0;

            scatterAngle = 0;

            damage = 20;
            mass   = .75f;

            bulletDirection = new Vector2(1, 0);

            speed = Vector2.Zero;

            scatterShots = new List <Shots>();
        }
Beispiel #36
0
        public Fireworks(TankGame cGame, Vector2 position)
            : base(cGame)
        {
            this.position = new Vector3(position.X, position.Y, 0);

            switch ((int)DPSFHelper.RandomNumberBetween(0, 3))
            {
            case 0:
                startColor = Color.Yellow;
                endColor   = Color.DarkRed;
                break;

            case 1:
                startColor = Color.LightCyan;
                endColor   = Color.Green;
                break;

            case 2:
                startColor = Color.LightBlue;
                endColor   = Color.DarkBlue;
                break;
            }
        }
Beispiel #37
0
        public void scatter()
        {
            if (scatterTime >= 1)
            {
                damage = 10;

                for (int i = 0; i < 8; i++)
                {
                    scatterDirection = TankGame.rotateVector(bulletDirection, scatterAngle);

                    scatterShots.Add(new Shots((TankGame)Game, this.position,
                                               scatterDirection * new Vector2(TankGame.GRAVITY * 10 + .25f, -TankGame.GRAVITY * 10 - .25f)));

                    scatterAngle += (float)Math.PI / 7;

                    Game.Components.Add(scatterShots[i]);
                }

                if (position.Y < 200)
                {
                    speed = new Vector2(0, TankGame.GRAVITY * mass * 40);
                }
                else if (position.Y < 800)
                {
                    speed = new Vector2(0, TankGame.GRAVITY * mass * 20);
                }
                else
                {
                    speed = Vector2.Zero;
                }

                scattered = true;

                bulletCollided();
            }
        }
Beispiel #38
0
        public Fireworks(TankGame cGame, Vector2 position)
            : base(cGame)
        {
            this.position = new Vector3(position.X, position.Y, 0);

            switch ((int)DPSFHelper.RandomNumberBetween(0, 3))
            {
                case 0:
                    startColor = Color.Yellow;
                    endColor = Color.DarkRed;
                    break;

                case 1:
                    startColor = Color.LightCyan;
                    endColor = Color.Green;
                    break;

                case 2:
                    startColor = Color.LightBlue;
                    endColor = Color.DarkBlue;
                    break;

            }
        }
Beispiel #39
0
 public MoveHintScreen(TankGame game)
     : base(game)
 { }
Beispiel #40
0
 public GameOverScreen(TankGame game)
     : base(game)
 {
     this.game = game;
 }
Beispiel #41
0
 public ScreenManager(TankGame game)
     : base(game)
 {  }
Beispiel #42
0
 public ShootHintScreen(TankGame game)
     : base(game)
 {
 }
Beispiel #43
0
 public ConfettiDrop(TankGame cGame, Vector2 position)
     : base(cGame)
 {
     this.position = new Vector3(position.X, position.Y, 0);
 }
Beispiel #44
0
 public Bullet(TankGame game)
     : base(game)
 {
     type = BulletType.NullBullet;
 }
Beispiel #45
0
 public ConfettiDrop(TankGame cGame, Vector2 position)
     : base(cGame)
 {
     this.position = new Vector3(position.X, position.Y, 0);
 }
Beispiel #46
0
 public DirtTrail(TankGame cGame, Vector2 newPosition, Vector2 newDirection)
     : base(cGame)
 {
     position  = new Vector3(newPosition.X, newPosition.Y, 0);
     direction = new Vector3(newDirection.X, newDirection.Y, 0);
 }
Beispiel #47
0
 public GameOverScreen(TankGame game)
     : base(game)
 {
     this.game = game;
 }
Beispiel #48
0
 public TeleportBlast(TankGame cGame, Vector2 newPosition)
     : base(cGame)
 {
     position = new Vector3(newPosition.X, newPosition.Y, 0);
 }
Beispiel #49
0
 public Tanksplosion(TankGame cGame, Vector2 position)
     : base(cGame)
 {
     this.position = new Vector3(position.X, position.Y, 0);
 }
Beispiel #50
0
 public PowerUpHint(TankGame game)
     : base(game)
 { }
Beispiel #51
0
 public HealthPack(TankGame game, SpriteBatch batch)
     : base(game)
 {
     batcher         = batch;
     healthPackImage = Game.Content.Load <Texture2D>(@"Images/HealthPackTexture");
 }
Beispiel #52
0
 public TeleportTrail(TankGame cGame, Vector2 position)
     : base(cGame)
 {
     this.position = new Vector3(position.X, position.Y, 0);
 }
Beispiel #53
0
 public BasicBlast(TankGame cGame, Vector2 position) : base(cGame) 
 {
     this.position = new Vector3(position.X, position.Y, 0);
 }
Beispiel #54
0
 public Background(TankGame game)
     : base(game)
 {
     this.game = game;
 }
Beispiel #55
0
 public PowerUpManager(TankGame game)
     : base(game)
 {
     this.game = game;
 }
Beispiel #56
0
 public Flare(TankGame cGame, Vector2 newPosition)
     : base(cGame)
 {
     position = new Vector3(newPosition.X, newPosition.Y, 0);
 }
Beispiel #57
0
        public Tank(TankGame game, Vector2 tankPosition, float turretAngle)
            : base(game)
        { 
            this.game = game;
            this.tankPosition = tankPosition;
            turretPosition = new Vector2(tankPosition.X + 40, tankPosition.Y + 25);
            this.turretAngle = turretAngle;
            health = 200;
            turnTime = 0;
            moveLimit = 0;
            originalTurretDirection = new Vector2(0, 1);
            turretDirection = new Vector2((float)(Math.Cos(-turretAngle) * originalTurretDirection.X - Math.Sin(-turretAngle) * originalTurretDirection.Y),
                (float)(Math.Sin(-turretAngle) * originalTurretDirection.X + Math.Cos(-turretAngle) * originalTurretDirection.Y));
            bullet = new Bullet(game);
            type = BulletType.BasicBullet;
            inventory = new Inventory(game);
            damageClouds = null;
            timer = 0.0f;

            currentTankState = TankState.Normal;
        }
Beispiel #58
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="cGame">Handle to the Game object being used. Pass in null for this 
        /// parameter if not using a Game object.</param>
        public BasicParticleSystem(TankGame cGame)
            : base(cGame)
        {

        }