Event actions after sub-events

For questions about using Classic.

Post » Wed Mar 11, 2009 9:33 am

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?
B
2
S
2
G
3
Posts: 105
Reputation: 1,510

Post » Wed Mar 11, 2009 11:26 am

Why not just a blank subevent after all the others which runs those actions?
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Wed Mar 11, 2009 12:44 pm

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.
B
2
S
2
G
3
Posts: 105
Reputation: 1,510

Post » Wed Mar 11, 2009 1:24 pm

Just put another "On control 'Move up' pressed" event immediately after that other event.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests