Ask here your questions to get help using GDevelop.
By MattLB
#70610 Do you want 1 to be added every second only when sprite 1 exists? If so you would have conditions something like:

The number of sprite1>0
The timer "incscore" is greater than 1 seconds

and actions:

Do +1 to global variable number
Reset the timer "incscore"

An alternative any time you want to do something per second is to use TimeDelta(). This simplifies the event to
The number of sprite1>0
Do +1*TimeDelta() to global variable number
User avatar
By Lizard-13
#70619 In case you want two events separated:

When 'sprite1' is created, add 1 to global variable 'number'

There's no condition to check if an object has been created, the best way is to add the actions (in this case increase the variable) in the same event where you create the object:
Code: Select allConditions: The conditions in the event you create the Sprite
Actions: Create object Sprite
         Do + 1 to scene variable "number"

I would also like to 'add 1' every 1 second

As explained by MattLB, every second increase the variable:
Code: Select allConditions: Timer "increase_variable" is greater than 1 second
Actions: Do + 1 to scene variable "number"
         Reset timer "increase_variable"
By JimmyD
#70622 Thanks guys, nearly there!
Still not working though?
Please see attached image.
'money' is a text sprite with '0' in it, I dont have the option to update the GV 'number'.
Thanks again
2.JPG (30.76 KiB) Viewed 197 times
Last edited by JimmyD on Mon 11 Feb 2019, 16:11, edited 1 time in total.
User avatar
By Lizard-13
#70625 Using global variables is ok, just want to make sure that you know what you're doing ;)

I know it not working, as I am waiting 1 second and the 'money' is not going up.

But what is the action that updates the money object?, there's no magic, you update the variable but you've to do something extra to show that on screen (or use the debugger), that's why I'm asking how you know it doesn't work.

For example if "money" is a text object, after updating the variable you can add this action to update the money text:
Code: Select allDo = GlobalVariableString(number) to the text of money (text object)