" Do = " I see this a lot on discussions, what is it?

Firstly I feel like this could possibly be the smoothest question ever asked on here. I often see discussions and someone will say the correct code is something like:

Do = 1 To Variable myStruct[“myChildVar”]
So, you can simulate dynamic arrays (declared during an iteration for example):
Do = 1 To Variable myStruct[VariableString(myCounterVar)].myChildVar

If someone can help me understand the "do = " part with a simple example (not necessarily this one), that would be great. I have a feeling the “do” is just some condition maybe and the = is the action part. Possibly java script talk? I am a few months into this and never learned any programming before but happy to try.

So in that example, i’m trying to up my understanding of variables, after receiving advice from other users , but I run into this language and get confused. My level of ability is that I can make a card game, have an array , shuffle, discard and reload your hand on the next turn using variables. BUt I couldn’t tell you why an array works better than a structure in that scenario.

I keep feeling the urge to delete this and figure it out because it feels so obvious lol.

1 Like

For displaying player HP from its object variable Player.Variable(HP) by modifying text of text object

Do = ToString(Player.Variable(HP))

To make countdown timer in 60 sec loop even if you have more than 60 for example 100 so it first count down 60 then 40

Do = mod(CountdownTimer,60)

“Do” is like “make/write/use” this

So another example
To make HP bar shrink based on how much HP left on object you will need formula so

Do = WidthOFHPBar / MaxHealth * Current Health

So in changing width of HP bar you simply put (instead of some static number)

“Do” is nothing more than us instructing users WHAT TO DO

If you find older posts with “Do =…” you could read them today as ZeroX4 suggested as instruction for you, originally these “Do = …” statements would appear in the event sheets as instruction to the engine. You can see them in older screen snips of the events, some of them are still in the documentation.

Whenever you find the “Do = …”-actions you need to keep in mind that Gdevelop has changed quite a lot in the last few years. Most of the logic is still the same but it may be that not all of those older events are directly usable anymore.

Here is an example of older events:


So i was half right
I seen a lot of these screenshot from older version and i did see that Do
But i did not connect dots that it is remanent of what users remember from that older version

1 Like

Thank you both for your answers, that makes sense :grinning:

I’ll go and have a mess around and see how far I can go! Happy game making!

Oh wow, that comes from a post and part of the documentation I wrote more than 8 years ago :man_white_haired:

As others users have pointed out, “Do = # to variable ?” was how the “Change scene variable ? = #” action was displayed in the editor at that time, but it’s the same thing.

As for the second part of those actions:




That is a very direct way to deal with arrays or variables nested insides structures, and it was the only way to do it at that time. These days you can find a comprehensive and much more accesible set of conditions and actions to deal with arrays and structures under…

Variables—› [Global/Scene] Variables—› Arrays and Structures

… in the conditions/actions window. So, you don’t have to use those complex expressions anymore (but they are very practical if you know how to use them and as far as I know they still work).

1 Like

Thanks bud, I need to sit down and work through understanding how it all works I think. Everytime I sit down to make something/continue I keep adding in increasingly complex ideas lol

I get the old thing, I’ve played too many games and now I need something unique because most new games just have the same patterns!

GDevelop is very easy to use this days. Here’s a video explaining the advanced use of variables (arrays, structures, etc): https://youtu.be/0vlCEVUP1YA?si=6rmU41q96lk6ipI7

But, that’s a more advanced topic, and if you’re learning game development in general (and not just how to use GDevelop interface), then I recommend you to go slow. Anyways, you’re in the right place, because this engine is amazing for beginners.

A very good idea is to follow the basic tutorials from the GDevelop YouTube channel, there’s tons of useful tips there and they explain everything from scratch.

1 Like

Thanks. Yeah I watched that tutorial a while back but didn’t find it too helpful in terms of examples. I stumbled across your old comments and found them intriguing since they’re like an explosive stepping stone for knowledge, useful it so many ways if I can my head around them or find a tutorial like that.

Currently i’m using arrays instead of health bars since I can have different values input and get different effects coming out. So each enemy had an array as an object variable …this failed miserably as I was unable to use it with the arraytools and usual methods…

So I switched to scene variable arrays and am trying to learn how to simplify it (rather than 1 or 2 scene variable arrays per enemy) - and also could I automatically create one, so your comments seemed useful in this way, since I’m still trying to grasp what i can and cant do and when an array is more suitable than a structure.
(I realise that maybe hard to read due to awful wrting! apologies! I don’t expect any answers as this thread is about other things etc)