How do I arrange global variables?

0 favourites
  • 4 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • Hi, dear Construct community,

    I've mentioned before, I'm making a life simulator game. I have 3 global variables; money, success, and popularity. My player will face different random events and they will answer them yes/no. According to their answer, their global variables will increase or decrease. All the random events have different consequences so when they answer an event their popularity increases but maybe their success decreases. Or both of their money and success will increase. It all depends on the different events(I have 100 of them nearly). How can I arrange my 3 global variables for all of the random events? Should I use functions and how? Or is this even possible?

    Thank you.

  • Not sure if this answers your question, but you can make a helper function to optimize your code and quickly change multiple values at once.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What do you mean by arrange? Organize the global variables? How do you place them in the Event Sheet? Or are you referring to updating the global variables? If it is the first, that is up to you really, but you can look at dop2000's post.

    If you are referring to how to tell EventX to increase popularity and decrease success, that is a simple action in the event itself. System > Add To variable or Subtract From variable and choose what you want.

    If your events are loaded at run time not hard coded in an event sheet, then best is to give them an "id" and when you load one at run time, check the id and based on that, reduce/increase the variable you want.

    If you are referring to something related to UI, then that is a different matter and it is a matter of aesthetic and not something related to C3 unless you don't know how to create UI in C3.

  • Dear Vallar,

    This is my array, it includes random events and answers. For example, if the player chooses the yes answer in the 0,0 coordinates, his money will increase by 500 but his popularity will decrease by 50. And I have 100 random events like that and all of them have different outcomes. ı'm not sure how to arrange my 3 global variables; popularity-money and success according to the answers given by players (yes/no).

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