Is there an easy way to play a wav sound while my sprite is playing and stop when the sequence is complete?
Thanks.
[import]uid: 28709 topic_id: 14819 reply_id: 314819[/import]
Is there an easy way to play a wav sound while my sprite is playing and stop when the sequence is complete?
Thanks.
[import]uid: 28709 topic_id: 14819 reply_id: 314819[/import]
spriteInstance.animating returns true if the sprite is animating
http://developer.anscamobile.com/reference/index/spriteinstanceanimating
so constantly check for “animating” and stop the sound if it returns false…
should work.
-finefin [import]uid: 70635 topic_id: 14819 reply_id: 54834[/import]
GREAT!
Thanks a lot for the help.
[import]uid: 28709 topic_id: 14819 reply_id: 54863[/import]
Rather than polling I found this works well
A string indicating the phase which the sprite animation is currently in. Can be one of the following values:
“end” - the sprite stops playing
“loop” - the sprite loops (from last to first, or reverses direction)
“next” - the sprite’s next frame is played
Syntax:
event.phase
Example:
local function spriteListener( event )
print( “Sprite listener” … event.name, event.sprite, event.phase,
event.sprite.sequence
end
– Add sprite listener
instance:addEventListener( “sprite”, spriteListener )
[import]uid: 28709 topic_id: 14819 reply_id: 55078[/import]