It looks like you're new here. If you want to get involved, click one of these buttons!
@GregBUGthanks to you too. and it also seems the example 2 is not giving event to onStartAnimationis this also a bug?
function CPlayer:init(playerType) self.lastDirection = 1 self.anim = CTNTAnimator.new(crockLoader) self.anim:setAnimation("CROCK_IDLE_DOWN") self:addEventListener(Event.ENTER_FRAME, self.onEnterFrame, self) self.anim:addToParent(self) self.w = application:getLogicalWidth() + 32 self.h = application:getLogicalHeight() + 32 self.xPos = application:getLogicalWidth() /2 self.yPos = application:getLogicalHeight() /2 self.speed = self.anim:getSpeed() self:setPosition(self.xPos, self.yPos) end function CPlayer:start() self.anim:playAnimation() end
-- create crock object... local crock = CPlayer.new() -- assign events... crock.anim:addEventListener("ANIM_START", onStartAnimation, event) crock.anim:addEventListener("ANIM_STOP", onStopAnimation, event) crock.anim:addEventListener("ANIM_CHANGE", onChangeAnimation, event) -- start animation... crock:start()
Comments
thanks for report.!
www.tntengine.com
thanks to you too.
and it also seems the example 2 is not giving event to onStartAnimation
is this also a bug?
events work fine.
it's how example 2 is written.
try to change example2:
example2 modified in next version...
thanks for report...
now check "alpha border" bug... in editor..
stay tuned.
www.tntengine.com
all right thanks. i would like to add suggetions. when i use addEventListener, the event object should contain the object which send the event.
and is this the expected behavior? when i add eventlistener like this in class Foo :
self._explodeAnim:addEventListener("ANIM_STOP", self._onExplodeStopAnimation, event)
and i have object of class SubFoo which inherits Foo and override self._onExplodeStopAnimation
but the function that is called is the one in Foo. it should be the one in SubFoo right?
Do you also add event listeners in SubFoo class? Because event listeners are added to specified instance, not all class instances.
no, i didnt. i add it in the init function in foo class. well, adding add event listener in init function in SubFoo did the trick, but is this the expected behavior? afaik normally, the override function is called
sorry for the BUG delay on Bug FIX animator but i'm working on TNT Collision (hope to release tomorrow!)
after that i'll update Animator to support collision and hopefully also your bug report!.
www.tntengine.com