Why does ''target is null'' display to me?

I’m on level Backwoods Brawl, and every time, when I attack, I get a message saying ‘‘target is null’’. I’m using this:

enemy = self.findNearestEnemy()

    if self.isReady("power-up"):

Can somebody help me?

you are setting enemy OUTside the loop…(so it never changes)

1 Like

please edit your code like this

some more code

if you are looking for several enemies u have to find the enemy iside the loop.
there is not everytime an enemy, use if/else to define what u do.

there are several posts in this forum about the same problem… if you would have searched u would have found a reason…
Try this…


like this

is not very helpful. I contacted AdsmeGames how to do it properly. The easiest way to show this to someone in the future is to simply point them to the FAQ.

1 Like

Another quick problem is that you are not checking if an enemy exists before you attack it