How do I

0 favourites
  • 12 posts
  • Hi,

    I have a main touch event with some action and under it there is a sub-event that contains lot of actions and system waits, now when touch event is raised again(2nd time) before completion of the sub-event(from first touch) I want to stop the sub-event ( from first touch) and start over. How do I achieve it.

    Thanks

  • What are the 'waits' used for ?

  • Hi,

    I have a main touch event with some action and under it there is a sub-event that contains lot of actions and system waits, now when touch event is raised again(2nd time) before completion of the sub-event(from first touch) I want to stop the sub-event ( from first touch) and start over. How do I achieve it.

    Thanks

    You can use a global variable as a trigger on your sub events just like on the main event.

  • What are the 'waits' used for ?

    waits are system waits, like wait 5 second before another action is executed.

  • When user touches sprite for second time I want to stop execution of that event[from first touch] and start over.

  • When user touches sprite for second time I want to stop execution of that event[from first touch] and start over.

    Use a global variable as a trigger.

    Global variable Trigger = 0

    Main event:

    Do something:

    On Trigger =1

    Sub event:

    Wait so many seconds:

    On Trigger =0

    On Sprite touched: Set Trigger =1

    Trigger = 0

    On Sprite touched: Set Trigger =0

    Trigger = 1

    You can use global variables in sub events to trigger only certain actions just like you can for main events.

  • Global variable is best friend to this... just like lamar example. that is perfectly what you need

  • Global is not gonna be enough, when using 'waits'. shaurya speaks about '5 seconds' postpones.

    Then postponed actions will run anyway, when their time has come, independent of the global.

    Thing is, i dont know how to stop a postponed action. You can stop postponed conditions. But then you need to use a 'timer' instead of 'wait'.

    Allow me again to beg you for not using 'wait'.

  • Global variable is not enough when you have event with lot of actions and waits. Actually my event is around 20 seconds long. I want to exit event execution, say when its half way though like 10 second when same event is raise again.

    My event looks like this:

    Touch|On tap gesture on sprite8 : textbox1: set visible

    system: wait 5 seconds

    textbox2: set visible

    system: wait 2 seconds

    sprite3: set visible

    system: wait 3 seconds

    sprite5: set animation frame to 3

    system: wait 4 seconds

    textbox4: set font color to rgb(0,0,255)

    system: wait 4 seconds

    sprite5: set animation frame to 2

    ...

  • lamar, thx 4 deleting that last post. Appreciated.

    As i said, i dont know how to stop postponed actions. But you can stop timed conditions.

    https://www.dropbox.com/s/h3f1i61ohw40r ... .capx?dl=0

    To complicated? Plz give me a better way, would really like to know.

  • lamar, thx 4 deleting that last post. Appreciated.

    As i said, i dont know how to stop postponed actions. But you can stop timed conditions.

    https://www.dropbox.com/s/h3f1i61ohw40r ... .capx?dl=0

    To complicated? Plz give me a better way, would really like to know.

    A postponed action never happens if that event or sub event is dependent on a trigger variable.

    I removed the post that showed how to do it because I want you to try and explain a better way?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Tkanks all.

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