Bug? Help Please!


#1

This may or may not be a bug as i am a noob :stuck_out_tongue: 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?


#2

For A Snap Shot of this with details pointed out here

:wink: :smile: :wink:


#3

The correct code is:
enemy1 = self.findNearestEnemy()
self.attack (enemy1)
self.attack (enemy1)

Its self. not self:

Use a dot instead of a colon


#4

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.)


#5

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. :wink:


#6

Thx that was the problem , again thx very much , didnt realize that was the problem :stuck_out_tongue: