Stencyl 3.4.0 is now out. Get it now!

Attribute wont continue increasing on scene change

TyJayLo

  • Posts: 11
I am making an idle game right now and I made a shop to buy items to increase the currency per second, but when I transition back to the main scene, the attribute stops going up, how do I get it where my currency keeps increasing even when I switch scenes?

squeeb

  • Posts: 1128
You have to use  purple  attributes.. those can be saved and loaded

TyJayLo

  • Posts: 11
I know that, but it still wont continue

LIBERADO

  • *
  • Posts: 2428
Create a time event in each scene to increase the currency per second.
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

TyJayLo

  • Posts: 11
Create a time event in each scene to increase the currency per second.
But if i do that than it will go up without me buying anything, and it would stack every time I switch scenes.

thechaosengine

  • *
  • Posts: 327
wrap the 'do every second' time event in a boolean attribute that gets set to true when you buy the item that increases the currency per second?

TyJayLo

  • Posts: 11
wrap the 'do every second' time event in a boolean attribute that gets set to true when you buy the item that increases the currency per second?
That doesnt seem to work


TyJayLo

  • Posts: 11
Post some code?
It would be great if someone could do that


squeeb

  • Posts: 1128
Post some code?
It would be great if someone could do that
Please could you post the code that you already have?
Yeah.. I meant post what you have and we can try and fix it :)

TyJayLo

  • Posts: 11
Also, what would be the proper way to count money per second?

squeeb

  • Posts: 1128
This code will happen only one time.  When mouse is pressed on actor... and the do after will happen only once.. You wantn to have a boolean switch here.. if enough money to buy it.. set to true.. and do the rest of the code in a scene event when created,  if Boolean true.. do every 1 second. If I'm understanding what you're trying to do

TyJayLo

  • Posts: 11
This code will happen only one time.  When mouse is pressed on actor... and the do after will happen only once.. You wantn to have a boolean switch here.. if enough money to buy it.. set to true.. and do the rest of the code in a scene event when created,  if Boolean true.. do every 1 second. If I'm understanding what you're trying to do
Could you show me the code?

squeeb

  • Posts: 1128
do something like this in a scene created event. this will happen every 1 second.. i used it for time..  every 1 second it will add 1 to the timer for score att.... in the next scene you will set the money attribute when created to the money attribute from last scene with the money getter.. and do another every 1 second event in that scene as well