One shot tweening a value seems to revert to zero after completion.

0 favourites
  • 3 posts
From the Asset Store
Shoot balls to destroy as many blocks as possible, at each stage the game will become more difficult.
  • Hi, I'm basing an objects speed on a tween value.

    The object accelerates niceley but when the tween finishes the speed goes straight to zero. Here is the code..

    My function:

    * On function 'TL_Ease_To_New_Train_Speed'

    * Parameter 'new_train_speed' (Number)

    -> TL_Speed_Easer: Tween "Tween Speed" value from train_speed to new_train_speed in 5 seconds (Linear, destroy: No, loop: No, ping pong: No)

    And every tick I match my train speed to the tween value..

    + System: Every tick

    -> System: Set train_speed to TL_Speed_Easer.Tween.Value("Tween Speed")

    Any ideas? I would expect the value of the tween to remain at its end value once finished.

    Tagged:

  • The problem is that once the tween is finished, it doesn't exist anymore.

    After it has completed if you continue to query it's value on every tick, the expression just returns 0, because it can't find the tween.

    Try setting up a trigger that waits for the tween to complete and then saves the ending value in a variable, and you can use that after the tween is over.

    Or maybe check for the tween to be playing before trying to use the value.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Gotcha Thanks.

    Instead of every tick, I just use 'Is Tween Playing' and it works perfectly.

    + TL_Speed_Easer: Is Tween "Tween Speed" playing

    -> System: Set train_speed to TL_Speed_Easer.Tween.Value("Tween Speed")

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)