Click on the “Add action”, select the “Other actions” tab, expand Variables, expand “Scene variables”. Since it’s the score you want to change, you’ll want the “Change number variable” option.
Some languages have what’s called strongly typed variables. That means when a variable is declared as a number, string or another type, it can only be used as that.
GDevelop is weakly typed, which means you can declare a variable as a certain type, but if it’s contents satisfy another type, you can use it as that too.
A good example is a boolean - it’s either true or false. But, behind the scenes it’s stored as a 0 or 1. So GDevelop allows you to access it as a number. And, as a 0 or 1 can be represented as a string (“0” or “1”), you can access it like a string too. GDevelop will attempt to interpret it as the type that is used in the condition or action
(Actually, a boolean is false if it’s 0 or empty and it’s true otherwise, so you can set a variable to “2” or “A” and the expression to check the boolean value will come back as true).
Thanks for your reply! I’ll check this out later on tonight.
EDIT: Checked it out, you were 100% correct about where it was, so thank you
However, it’s raised a different issue. I’d love some help with it if you have the time and energy. If not, no worries, and thanks for your help before.
Short version is ‘The score doesn’t change’.
The pickup disappears and the sounds plays, but the score doesn’t change.
Apart from a few minor aesthetic details (Zoom level, using different gfx/sounds), I’ve followed the tutorial as closely as I could.
(There are supposed to be screenies of the video tutorial and my event page here, for comparison, but the forum is giving me grief, so I might have to reply with them. Point is they are identical - apart from the aesthetic choices and…)
The only difference I can see is in the final line:
Change the text of scene variable Score: set to “Score:” + ToString(Variable(Score))
In mine, the word ‘Score’ is blue, not purple. I don’t know the engine well enough to know if that means anything yet.
Here are some details you might need:
I didn’t declare (or add, via any variables page/tabs) any variables because the video tutor didn’t.
I tried doing it that way as well (adding a variable called ‘Score’) but that didn’t work either.
I thought strongly-typed variables were inherent to programming - I had no idea that weakly-typed variables even existed. My confusion has disappeared now.
Your Boolean example was excellent, it made perfect sense - thank you so much!