Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

How to determine if there not any enemies


How do you see if there is no enemys


I think you use
if enemy = null:


You can use a super simple if statement.

if enemy:

Basically if enemy has any thangs (enemies/ objects) in it will run the code afterwards.


Well, before saying “if enemy”, you need a variable, enemy = hero.findNearest(enemies). At least thats what I use. Hope you knew. :+1::slight_smile:


True, my apologies, I assumed that enemy = hero.findNearest(hero.findEnemies) was out of the questions scope.


Thank you i’m new to the game :relaxed:


Just to tie up loose ends:

enemies = hero.findEnemies()
enemy = hero.findNearest(enemies)

if enemy: