Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
GTween setPaused gotcha ;) — Gideros Forum

GTween setPaused gotcha ;)

moopfmoopf Guru
edited October 2012 in General questions
Been banging my head against a brick wall this morning for an hour or so trying to work out why a GTween wouldn't respect setPaused straight after creation - the reason I'm doing this is to load back in a game state if the app was exited whilst you were in the middle of a game. Anyway, after trying to change code in GTween I decided to RTFM (well there is no manual, but I looked through the class for hints). There's an option that you can set called autoPlay - set this to false to stop the tween from automatically running, e.g:
<pre>
self.tween = GTween.new(self.image, 20, {scaleX=0}, {autoPlay=false})
Anyway, just thought I'd post it here in case other people encounter the same problem.

Likes: ar2rsawseen

+1 -1 (+1 / -0 )Share on Facebook

Comments

  • @moopf
    Also for those interested and to extend that discovery, autoPlay = false is the way to chain tweens.
    Here is the correct way to chain tweens:
    local tween1 = GTween.new(sprite, 1, {x = 240}, {})
    local tween2 = GTween.new(sprite, 1, {y = 100}, {autoPlay = false})
    local tween3 = GTween.new(sprite, 1, {alpha = 0}, {autoPlay = false})
    tween1.nextTween = tween2
    tween2.nextTween = tween3
    Also this is same:
    local tween3 = GTween.new(sprite, 1, {alpha = 0}, {autoPlay = false})
    local tween2 = GTween.new(sprite, 1, {y = 100}, {autoPlay = false, nextTween = tween3})
    local tween1 = GTween.new(sprite, 1, {x = 240}, {nextTween = tween2})

    Likes: ar2rsawseen, moopf

    twitter@TheWindApps Artful applications : The Wind Forest. #art #japan #apps
    +1 -1 (+2 / -0 )Share on Facebook
Sign In or Register to comment.