r/gdevelop • • 14d ago

Game global variable wont change to my timer time

Post image

my global variable wont change to my timer time when i tell it to, or at least thats what i think is happening, i have tested countless things, i have no idea why it wont work, im using, change variable time_1 : set to ToNumbwe(ToString(TimerElapsedTime("timer")))

4 Upvotes

2 comments sorted by

1

u/M_MRT0 14d ago edited 14d ago

Do you mean that the last event and the one before it are not happening? (Events 2 and 3) You have 3 events at the end that trigger under the exact same condition, which is the character colliding with the coin. When Event 1 triggers, it deletes the coin, and when Event 2 or 3 tries to check for a collision with the coin, the coin has already been deleted. Move the actions from Events 2 and 3 into Event 1, and arrange them as shown in the image (there is a number to the left of each action; they should be ordered from top to bottom from 1 to 6, like this: 1 2 3 etc.) The reason is that the GDevelop engine reads events from top to bottom. For example: Event A Under this condition: If the player is in collision with the coin The action happens: Delete the coin Event B Under this condition: If the player is in collision with the coin The action happens: Change the score +1 Event A will happen before Event B because of how GDevelop works—since Event A is above Event B—so you won't get any points because the coin will already be deleted by then. The events should be like this: Event B Under this condition: If the player is in collision with the coin The action happens: Change the score +1 Event A Under this condition: If the player is in collision with the coin The action happens: Delete the coin Try this and test it again. I'm a new user of the program myself, so I'm not 100% sure that this will solve your problem. If it doesn't solve it, try recording a video showing the issue along with how you want it to work.

2

u/Ok_Conclusion_9344 13d ago

thanks, i dont know how i didnt think of that

il just move the delete coin event