How to determine if there not any enemies

How do you see if there is no enemys

1 Like

I think you use
if enemy = null:

1 Like

You can use a super simple if statement.

if enemy:
    #hero.strike(enemy)

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

1 Like

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:

1 Like

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

1 Like

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

1 Like

Just to tie up loose ends:

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

if enemy:
    hero.attack(enemy)
1 Like