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

0 favourites
  • 8 posts
From the Asset Store
14 amazing sound files of game events like Level Ups, Level Completes, object spawn, object taking etc.
  • 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.

  • 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.

  • 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"

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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 ?

  • 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?

  • 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!

  • Ok, guess I'll try the variable approach then. And I'll read up about findings too C-7 . Thank you guys.

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