I'm start using gideros mobile for about a week now, really great engine, however with so little experiences about lua I've many problems in using Gideros. Please help me out
here is my code snippet
coins = Sprite.new()
stage:addChild(coins)
function onEnterFrame(event)
local coinNum = coins:getNumChildren()
print(coinNum)
end
result: 841
another issue
function coin:init()
self:addEventListener(Event.ENTER_FRAME, self.onEnterFrame, self)
end
function destroyBody()
self:removeEventListener(Event.ENTER_FRAME, self.onEnterFrame, self)
self:removeFromParent()
end
result: attempt to index global 'self' (a nil value)
the result I've got seem like a random number everytime I run my project
and sorry for my bad English, too
Comments
You will need some tutorial about lua + OOP.
Likes: leduylinh87
The second problem was solved, thank to jdbc's reply, I forgot to declare coin:destroyBody() instead of destroyBody() feeling really dump, thanks you very very much, how about the first problem? Can you help me on that one too please, it's been 4 hours tearing my hair off about that
I'm not really sure about the first issue, but now I've tried another way around this issue, and it work fine, now, thank you ^^