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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
private void OnPlayerKilled(Enemy killedBy) { //Player.OnKilled(killedBy); Player.Stress.enemyDetect(); }
/// <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); }