Esempio n. 1
0
        protected virtual void Attack()
        {
            gametimepassed += GameEngine.gameTime.ElapsedGameTime;

            if (Keyboard.GetState().IsKeyDown(Keys.Z))
            {
                if (gametimepassed > TimeSpan.FromMilliseconds(30))
                {
                    gametimepassed = TimeSpan.Zero;
                    //each single bullet is an individual in-game-object. it knows what it should do
                    new Bullet(this, Images.MyBullet, DefaultSizes.DefaultBulletSize, new PlayerBulletBehavior(), new Vector2(0, -20));
                }
            }
            if (Keyboard.GetState().IsKeyDown(Keys.X))
            {
                if (gametimepassed > TimeSpan.FromSeconds(2))
                {
                    gametimepassed = TimeSpan.Zero;

                    while (Arena.Count() > 4)
                    {
                        Arena.RemoveAt(Arena.Count() - 1);
                    }
                    //each single bullet is an individual in-game-object. it knows what it should do
                    new Bullet(this, Images.MyBullet_bomb, DefaultSizes.DefaultBulletSize, new PlayerBulletBehavior(), new Vector2(0, -1));
                }
            }
        }