Exemple #1
0
        public void Spawn(int x, int y)
        {
            // X and Y is tile position, so work out a pixel position to spawn at
            // Remember that our sprite origin is located bottom centre (at the feet), so add half width and full height
            Vector2 spawnPos = new Vector2((x * Map.TILE_WIDTH) + (Enemy.FRAME_WIDTH / 2), (y * Map.TILE_HEIGHT) + Enemy.FRAME_HEIGHT);

            // Make a new enemy, using the soldier spritesheet
            Enemy newEnemy = new Enemy(spawnPos);

            // Add the enemy to the pool
            Enemies.Add(newEnemy);
        }
Exemple #2
0
        /// <summary>
        /// Called when the player has been killed.
        /// </summary>
        /// <param name="killedBy">
        /// The enemy who killed the player. This parameter is null if the player was
        /// not killed by an enemy (fell into a hole).
        /// </param>
        public void OnKilled(int playerIndex, Enemy killedBy)
        {
            playerStates[playerIndex] = PlayerState.Dead;
            if (playerIndex == 0)
            {
                if (killedBy != null)
                    killedSound.Play();
                else
                    fallSound.Play();
            }

            playAnimationForSprite(playerIndex, dieAnimation);
        }
Exemple #3
0
 /// <summary>
 /// Called when the player is killed.
 /// </summary>
 /// <param name="killedBy">
 /// The enemy who killed the player. This is null if the player was not killed by an
 /// enemy, such as when a player falls into a hole.
 /// </param>
 private void OnPlayerKilled(Enemy killedBy)
 {
     Player.OnKilled(killedBy);
 }
Exemple #4
0
        /// <summary>
        /// Called when the player has been killed.
        /// </summary>
        /// <param name="killedBy">
        /// The enemy who killed the player. This parameter is null if the player was
        /// not killed by an enemy (fell into a hole).
        /// </param>
        public void OnKilled(Enemy killedBy)
        {
            isAlive = false;

            if (killedBy != null)
                killedSound.Play();
            else
                fallSound.Play();

            sprite.PlayAnimation(dieAnimation);
        }
Exemple #5
0
 /// <summary>
 /// Called when the player has been killed.
 /// </summary>
 /// <param name="killedBy">
 /// The enemy who killed the player. This parameter is null if the player was
 /// not killed by an enemy (fell into a hole).
 /// </param>
 public void OnKilled(Enemy killedBy)
 {
     isAlive = false;
     //sprite.PlayAnimation(dieAnimation);
 }
Exemple #6
0
 private void OnPlayerKilled(Enemy killedBy)
 {
     //Player.OnKilled(killedBy);
     Player.Stress.enemyDetect();
 }
Exemple #7
0
        /// <summary>
        /// Called when the player has been killed.
        /// </summary>
        /// <param name="killedBy">
        /// The enemy who killed the player. This parameter is null if the player was
        /// not killed by an enemy (fell into a hole).
        /// </param>
        public void OnKilled(Enemy killedBy)
        {
            isAlive = false;

            sprite.PlayAnimation(dieAnimation);
        }