Event actions after sub-events

This forum is currently in read-only mode.
  • I want to execute an action for an event, but only after the sub-events. Is this possible? I can't seem to do it here.

    I want it to work something like this:

    On Control "Move Up" Pressed:

    Compare Global Variable "Combo" to 0

    -- Create Object at ... "Combo icon 1"

    -- Start timer "ComboTimer" ... 250ms

    Compare Global Variable "Combo" to 1

    -- Stop timer "ComboTimer"

    -- Create Object at ... "Combo icon 2"

    -- Start timer "ComboTimer" ... 250ms

    - Add 1 to Global Variable "Combo"

    Sorry for the pseudo code, I don't have access to my files right now. Hopefully you can see what I'm trying to do. I know there is an exmple for doing double tap dashing, but this is supposed to be more of a generic combo system, where the combo variable increments following several different key presses - up-up-A to perform a powerful uppercut, for example. Try combo variable is supposed to track which stage of the control sequence has been reached. Obviously, I can't increment combo in the sub-events, because it will make it cascade through both sub-events.

    Any suggestions for making this work, or am I going about it totally the wrong way?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Why not just a blank subevent after all the others which runs those actions?

  • Blank sub-events! Never thought of that!

    Cheers, although I've just realised that it won't work anyway. The combo variable will increment whether it is the right key or not, so you could press up-down-up and it would still increment on the second up press. However, if I change the order of sub-events to go from last to first I think I can increment the variable on the sub-event and not have it cascade.

    on Control "Move Up" pressed

    compare global variable "Combo" to 1

    -- do step 2 stuff

    -- Add 1 to "Combo"

    compare global variable "Combo" to 0

    -- do step 1 stuff

    -- Add 1 to "Combo"

    So if Combo==0 it will skip the first sub-event, do the second one, then increment it by 1. If Combo==1 it will do the first sub-event but skip the second. This system has timers in it as well so there is a limited time to make the combo sequence.

    Now, one more thing I need to add is making the combo reset if you press the wrong key. Would an else work at the end of this? If I was programming this I would use IFs, ELSE IFs and an ELSE, but I can't seem to get the ELSE condition working.

    I'll try this tonight and see how it goes.

  • Just put another "On control 'Move up' pressed" event immediately after that other event.

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