Sprite Handler onComplete?

Hi there,

is there something like a onComplete Handler? The event.phase ‘end’ does never get reached. I am playing a Sprite once and want to do something after it has been played.

Right now i am using a timer to change animation after this one.

Thanks! [import]uid: 90610 topic_id: 17298 reply_id: 317298[/import]

There is!

Example;
[lua]local function test (event)
if event.phase == “end” then
print “test”
end
end

sprite:addEventListener(“sprite”, test)[/lua]

In this case when the sprite stopped playing “test” would be printed in the terminal.

I gave this a quick test in Jungle Scene sample code and it worked fine :slight_smile:

Peach [import]uid: 52491 topic_id: 17298 reply_id: 65613[/import]

hi peach

thanks for your reply. I got it working now, the probs lay inside my code :).

do you know by any chance: is there a possibility to access properties of an image in a sprite sheet? like setting a diff reference point for different frames in the sequence? [import]uid: 90610 topic_id: 17298 reply_id: 65899[/import]

Hi Dingo,

Are you from Australia? (Just curious due to the name!)

You cannot set a different reference point for each frame, no. There are ways to change the reference point for different frames but it would require checking which frame the sprite was up to then setting the reference point accordingly.

Peach :slight_smile: [import]uid: 52491 topic_id: 17298 reply_id: 65913[/import]

yes, i could check for the current frame, and change the point there. thanks for the clarification.

And no, we are from switzerland :). But much in love with australia and dingos :slight_smile: [import]uid: 90610 topic_id: 17298 reply_id: 65918[/import]

No worries.

Peach :slight_smile: [import]uid: 52491 topic_id: 17298 reply_id: 66164[/import]