How do I get Tween to recognize its running

  • Hello;

    I am not sure if I should put "" around my tags for tween or if the problem is elsewhere. I believe this should send a message to text object after one second saying it is currently tweening. It sends the message when it is done tweening but not while it is tweening. See very short cp3 image below (its just a few lines).

    thanks for your time

  • I can see the mistake. You need to have the 'isPlaying' condition as a deeper sub-event to allow that Wait 1 second to really spend 1 second before moving on to its sub-event. See screenshot.

    At the moment, there are three sub-events under Start of Layout, and it checks for all of the three instantly - Hence, a wait 1 second in the middle doesn't affect the sequence or timing as there is technically no action after Wait 1 second.

  • Thanks Dr. Hasan;

    With your fix It works for 1 second wait.

    If I set the wait time to 0 it doesn't work. Once I call the tween function I guess it doesn't start right away.

    yours

    Winkr7

  • Yeah. You're right. It should. But apparently the way Tween behavior is built in C3, it starts in the next tick. Which is why it doesn't sense it 'playing' in that same 'tick' of events of Start of Layout.

    With anything else, the 0 seconds would work. Try opacity for example. It would work.

    A good work around is to let the timer start 'after' the tween actually has began playing, for example:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Dr. Hasan;

    This is a very good idea. Thanks for taking the time to answer.

    yours

    winkr7

  • Dr. Hasan;

    I am trying to do this with three boxes. If any one of them is moving the next box has to wait to move until the first box is done. Each box doesn't know how long the next box will be moving so it has to keep checking for when no box is moving. I tried to use signal for this, but it is clear I don't understand either the order events are executed in C3, what wait does, or what signal does. So using your ideas how do I get each box to wait for the next to finish moving?

    Thanks again for your time.

    yours

    winkr7

  • Like this ?

    If not, do post your own project and explain clearly what you are attempting to do, what you experience your current project doing instead.

  • Thanks Kyatric;

    I run the standard 157 non-beta version of C3 so I can't run your CP3 yet since it is beta, but as soon as we go to 159 I will definitely have a look.

    I appreciate the help.

    yours

    winkr7

  • Just use this URL : editor.construct.net/r159

    You'll be able to inspect his file.

  • Thanks Magistross. Will do.

  • Yep.

    Kyatric solution should work for you.

    If you don't want sequential, and want to move upon a different event, then you can instead have a global check like this:

  • Thankyou Kyatric and Dr. Hasan;

    Dr Hasan your example the problem is when I push the arrow key i starts up one box and if I push it while the box is moving it doesn't start up the next box when the first finishes moving. I tried to use a signal to get the next box to start when the first box finishes but didn't have any luck.

    Can you get your example to get the next box to start (only if the arrow key is pushed while the first box is moving)?

    I appreciate your time and help.

    yours

    winkr7

  • I think it's the right time for you to explore and play with variables.

    I'll give you a bit of hint, and will let you try out. Besides, I don't know what type of game are you making. But anyway:

    You want the next box to Start moving (after the previous box stops) provided that a Key was pressed in between the tween. Correct? For this, you can merge my solution with that of Kyatric.

    You'll have two variables (Boolean): Tweening, and keyPressed (default: False)

    That keyPressed variable will set true whenever a Key is pressed and it will remember (stay as true) that the key was pressed while the box was moving despite the actual key is released.

    Then, "On Tween Finished" you should also check with another condition (is keyPressed?), if yes, then it should call the Function to start the next box Tween. (or you can do as I did, select whichever you want to move, by Picking).

    Important: keyPressed should be set as False as soon as the box starts its Tween.

  • Dr. Hasan;

    Thanks for the help.

    yours

    winkr7

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