This may or may not be a bug as i am a noob but i am on the level named lowly kithmen on world one and i go ahead make a 2nd variable for the level and i do it corretly BUT when i attack it goes expected , and other stuff? Any idea? Im pretty sure i made the variable because i did local enemy2 = self:findNearestEnemy for the 2nd enemy so any idea why or how , or even if this is a bug?
The correct code is:
enemy1 = self.findNearestEnemy()
self.attack (enemy1)
self.attack (enemy1)
Its self. not self:
Use a dot instead of a colon
Actually @Mining_Magic is using Lua.
Though self:findNearestEnemy
is a method, so it should be used like in the first example (enemy1
).
(Error handling apparently isnโt too human friendly for languages not JavaScript or Python.)
I believe youโre missing the ()
to call the function:
local enemy2 = self:findNearestEnemy()
# here ---^^
Check again how it is done in the enemy1
assignment.
2 Likes
Thx that was the problem , again thx very much , didnt realize that was the problem