[SOLVED]How do I change events with other events?

Get help using Construct 2

Post » Sat Aug 08, 2015 4:03 pm

Hello World,

I'm gonna start working on a game where I have to ramp up difficulty in real time. So my question(though proably poorly written) is how can I change events with other events?
For example lets say that I have an event every 1.5 seconds | spawn enemy . And lets say that I want that to happen only while the score is under 100, when the score goes beyond 100 I want that event to change from 1.5 seconds to lets say 1 second. Another example let's say I have an event where I set the magnitude of a sine behavior to 40, again when the score reaches a certain point let's say I want that event to change the magnitude from 40 to 80. And so on and so forth. Multiple events, affecting different things, that would all need to have their properties changed in an instant.

So how would I do this? Should I use groups? I noticed when adding a group that it has a tickbox "active on start", am I correct in assuming that I could have a bunch of groups(one with the 1.5 seconds eevent, another group with the 1 seconds event, etc...) and then enable/disable them whenever I want?
Is that the way, does it have any pros/cons, is there a better way.... What do you guys suggest?

Thank you.
Last edited by VIKINGS on Sun Aug 09, 2015 12:54 pm, edited 1 time in total.
B
21
S
11
G
6
Posts: 414
Reputation: 5,335

Post » Sat Aug 08, 2015 4:10 pm

You should be able to use global variables. Use a function to set your score and every time the score changes check if you've reached your threshold and adjust the variables as appropriate. Using a timer instead of "Every X" will give you better control, and you can stop the old timeout and reset it to it's new value.
ImageImageImage
B
71
S
22
G
249
Posts: 3,762
Reputation: 138,575

Post » Sat Aug 08, 2015 4:14 pm

You could use group or global variable
eg with global variable:

set global variable "Timing" to 1.5
set global variable "MagnitudeSine" to 40

every "Timing" sec -> spawn enemy
score >= 100 and trigger once while true (or whatever you want) --> substract "timing" 0.5 and add "MagnitudeSine" 40

on enemy (or another object with sine behavior) created --> set enemy magnitude to "MagnitudeSine"
Image Image
B
25
S
14
G
139
Posts: 876
Reputation: 72,510

Post » Sat Aug 08, 2015 4:24 pm

Ok, thank you @MadSpy .
Is that what you where talking about too blackhornet? Because before I saw Spy's post I was about to write, quote:

"I'm not sure I'm understanding exactly what you mean @blackhornet (it's too damn hot!! I can't concentrate...:( ), I'm sorry. Could you please trow a bunch of events togheter so I can properly get what you're talking about."

And tell me guys, are there any pros/cons to using this idea with variables and any pros/cons to using my idea with groups?

P.S. For anyone else who would like to chime in to the discussion is there another way of doing this? And what are the pros/cons of that other way?

P.S.S. The reason why I am so insistent with pros/cons and multiple ways of doing it, is because this time it's not a case of "this is a small part of my game I'm having problems with". This time it's a case of "this is gonna be the main foundation for this game". That's why, it's not because I don't trust you or appreciate what you've said so far, kiss kiss. ;)
B
21
S
11
G
6
Posts: 414
Reputation: 5,335

Post » Sat Aug 08, 2015 4:44 pm

blackhornet wrote:You should be able to use global variables. Use a function to set your score and every time the score changes check if you've reached your threshold and adjust the variables as appropriate. Using a timer instead of "Every X" will give you better control, and you can stop the old timeout and reset it to it's new value.


@VIKINGS What don't you understand ?
Image Image
B
25
S
14
G
139
Posts: 876
Reputation: 72,510

Post » Sat Aug 08, 2015 5:26 pm

Like I said, after I saw your events @MadSpy I figured out what he meant. So now I understand, thank you.
Now I'd just like to know if there are any pros/cons to the variable way, pros/cons to the groups way and, in case there is yet another way to do it, what is that third way and what pros/cons does it have?
B
21
S
11
G
6
Posts: 414
Reputation: 5,335

Post » Sun Aug 09, 2015 4:11 am

Groups probably wouldn't be the best choice for this. They make sense in your head for this, but they're more for enabling/disabling an enemy's ai out something.

You'll want to use variables and functions more than likely--it'll save your butt later. Groups would be a lot of repeated code in this case. So if you want to change something later, you would need to make the same change repeatedly by hand for each group. If you just had it all reference a variable instead of hard-coding your numbers, you could make one change and not need to go through everything again. Definitely check out a tutorial on findings too. You could call a certain event with unique values anywhere you want in your code without any copy and pasting.

Use variables and functions. At some point, familiarize yourself with arrays and dictionaries, too if you aren't already!
B
103
S
38
G
19
Posts: 962
Reputation: 17,996

Post » Sun Aug 09, 2015 12:54 pm

Ok, guess I'll try the variable approach then. And I'll read up about findings too @C-7 . Thank you guys.
B
21
S
11
G
6
Posts: 414
Reputation: 5,335


Return to How do I....?

Who is online

Users browsing this forum: humanescape, jezjones24, Yahoo [Bot] and 28 guests