Ejemplo n.º 1
0
        // Initialize the player
        public void Initialize(Animation animation, Vector2 position)
        {
            PlayerAnimation = animation;

            // Set the starting position of the player around the middle of the screen and to the back
            Position = position;

            // Set the player to be active
            Active = true;

            // Set the player health
            Health = 50;
        }
Ejemplo n.º 2
0
        public void Initialize(Animation animation, Vector2 position)
        {
            // Load the enemy ship texture
            EnemyAnimation = animation;

            // Set the position of the enemy
            Position = position;

            // We initialize the enemy to be active so it will be update in the game
            Active = true;

            // Set the health of the enemy
            Health = 4;

            // Set the amount of damage the enemy can do
            Damage = 10;

            // Set how fast the enemy moves
            enemyMoveSpeed = 6f;

            // Set the score value of the enemy
            Value = 100;
        }
Ejemplo n.º 3
0
        public void LoadContent()
        {
            Debug.WriteLine("loaaad: " + spawnTime.ToString());

            LoadOptions();
            playerTexture = contentManager.Load<Texture2D>("shipAnimation");
            Animation playerAnimation = new Animation();

            //Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2);
            Vector2 playerPosition = new Vector2(300, 5);
            playerAnimation.Initialize(playerTexture, Vector2.Zero, 156, 49, 8, 30, Color.White, 1f, true);
            //shooter
            playerMoveSpeed = 14f;
            //Enable the FreeDrag gesture.
            TouchPanel.EnabledGestures = GestureType.FreeDrag;
            TouchPanel.EnabledGestures = GestureType.Tap;
            TouchPanel.EnabledGestures = GestureType.Hold;
            specialBulletTexture = contentManager.Load<Texture2D>("rocket");
            // Load the score font
            font = contentManager.Load<SpriteFont>("dobarFontJe");
            strongerEnemiesTexture = contentManager.Load<Texture2D>("mineAnimation1");
            // Load the music
            gameplayMusic = contentManager.Load<Song>("menuMusic");
            // Load the laser and explosion sound effect
            stoneTexture = contentManager.Load<Texture2D>("stone");
            laserSound = contentManager.Load<SoundEffect>("sound/laserFire");
            explosionSound = contentManager.Load<SoundEffect>("sound/explosion");
            bulletsTexture = contentManager.Load<Texture2D>("bullets");
            healthTexture = contentManager.Load<Texture2D>("health");
            specialBagTexture = contentManager.Load<Texture2D>("rockets");
            explosionTexture = contentManager.Load<Texture2D>("explosion");
            player.Initialize(playerAnimation, playerPosition);
            projectileTexture = contentManager.Load<Texture2D>("laser");

            laserTexture = contentManager.Load<Texture2D>("laser");

            scoreFont = contentManager.Load<SpriteFont>("ScoreFont");
            menuFont = contentManager.Load<SpriteFont>("MenuFont");
            //shooter
            enemyTexture = contentManager.Load<Texture2D>("mineAnimation");

            //highscores
        }
Ejemplo n.º 4
0
        public void AddStone(Vector2 position)
        {
            Animation stoneAnimation = new Animation();

            stoneAnimation.Initialize(stoneTexture, Vector2.Zero, 300, 58, 3, 30, Color.White, 1f, true);
            Vector2 Position = new Vector2(random.Next(stoneTexture.Height, graphicsDevice.Viewport.Width + stoneTexture.Height / 2), graphicsDevice.Viewport.Height);

            Stone stone = new Stone();

            stone.Initialize(stoneAnimation, Position);
            stones.Add(stone);
        }
Ejemplo n.º 5
0
        private void AddStrongerEnemy()
        {
            // Create the animation object
            Animation enemyAnimation = new Animation();

            // Initialize the animation with the correct animation information
            enemyAnimation.Initialize(strongerEnemiesTexture, Vector2.Zero, 60, 32, 6, 30, Color.White, 1f, true);

            // Randomly generate the position of the enemy
            Vector2 position = new Vector2(random.Next(strongerEnemiesTexture.Height, graphicsDevice.Viewport.Width + strongerEnemiesTexture.Height / 2), graphicsDevice.Viewport.Height);

            // Create an enemy
            Enemy2 enemy = new Enemy2();

            // Initialize the enemy
            enemy.Initialize(enemyAnimation, position);
            if (strongerEnemyMoveSpeed >= 16) strongerEnemyMoveSpeed = 10;
            enemy.enemyMoveSpeed = strongerEnemyMoveSpeed;
            enemy.Damage = strongerEnemyDamage;
            enemy.Health = strongerEnemyHealth;
            // Add the enemy to the active enemies list
            strongerEnemies.Add(enemy);
        }
Ejemplo n.º 6
0
        private void AddExplosion(Vector2 position)
        {
            Animation explosion = new Animation();
            explosion.Initialize(explosionTexture, position, 134, 134, 12, 45, Color.White, 1f, false);
            explosions.Add(explosion);

            //kada eksplodira nesto, vibriraj
            if (options.Count > 0 && options[1] == true)
            {

                vibrate.Start(TimeSpan.FromMilliseconds(100));
            }
        }