Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

How to play a sprite backward?
Started by JoePringles Jun 08 2019 06:05 AM

- - - - -
2 replies to this topic

Best Answer Lava Level , 08 June 2019 - 07:23 AM

Yes.

backward is set to start at frame 10 and only has a count of 1.  (count is how many frames to count up, not goto frame#)

 

instead of using start and count, just name the frame numbers like so...

 { name="forward", frames={ 1, 2, 3, 4, 5, 6, 7, 8 , 9, 10}, time=1000, loopCount=1 },
 { name="backward", frames={ 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}, time=1000, loopCount=1 },

[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

JoePringles

[GLOBAL: userInfoPane.html]
JoePringles
  • Contributor

  • 368 posts
  • Corona SDK

So here's my code:

local loadup_sequence = {
{ name="forward", sheet=loadup_sheet, start=1, count=10, time=1000, loopCount=1 },
{ name="backward", sheet=loadup_sheet, start=10, count=1, time=1000, loopCount=1 }
			}

local loadup = display.newSprite(loadup_sheet,loadup_sequence)
loadup.x=display.contentCenterX
loadup.y=display.contentCenterY
loadup:scale(2,2.4)
--loadup:setSequence( "forward" ) <----This works 
loadup:setSequence( "backward" ) -- <---Doesnt work
loadup:play()

Playing backward doesnt work.

Any idea why?



[TOPIC: post.html]
#2

Lava Level

[GLOBAL: userInfoPane.html]
Lava Level
  • Contributor

  • 274 posts
  • Corona SDK

  Best Answer

Yes.

backward is set to start at frame 10 and only has a count of 1.  (count is how many frames to count up, not goto frame#)

 

instead of using start and count, just name the frame numbers like so...

 { name="forward", frames={ 1, 2, 3, 4, 5, 6, 7, 8 , 9, 10}, time=1000, loopCount=1 },
 { name="backward", frames={ 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}, time=1000, loopCount=1 },

  • roaminggamer likes this

[TOPIC: post.html]
#3

JoePringles

[GLOBAL: userInfoPane.html]
JoePringles
  • Contributor

  • 368 posts
  • Corona SDK

Thanks comrade!


  • Lava Level likes this


[topic_controls]
[/topic_controls]