public void DetectCollision() { foreach (WorldMapMonster monster in monsters) { //check if monster is Alive and start combat only if it is Alive if (monster.isAlive && playerParty.partySprite.location == monster.location) { // monsterInCombat = monster; inCombat = true; combatGUI = new CombatGUI(); combatGUI.Visible = true; combatGUI.StartCombat(playerParty, monsterInCombat.member); } } foreach (WorldMapSprite fr in friendlyHeroes) { if (playerParty.partySprite.location == fr.location) { playerParty.partySprite.location.X += 40; if (fr.textFileName != "") { textBoxReader.OpenText(fr.textFileName, fr); } } } }
void KillMonsterInList(WorldMapMonster monsterToBeKilled) { foreach (WorldMapMonster monster in monsters) { if (monster == monsterToBeKilled) { monster.isAlive = false; } } }