What about array object and looping?


#1

Instead of doing like this:


Can I do this?(edited)

Is there any alternative for it? If not, then
It would be so great for making that type of apps or something (maybe a big game).

[trying to give an idea]

var games = [
. “Limbo”,
. “Mass Effect 2”,
. “Red Dead Redemption”,
. “StarCraft”
];
for(var i = 0; i<=games.length; i++) {
. //Modifies the Text object like this
. …“games[i]”;
. //Changing the y pos each time
. … text.Y()+50;
}
// I know it’s a simple thing for you


#2

hi you can group objects there is an icon in gdevelop
There are no arrays on gdevelop but you have structures variables that can work as an array
You could also JavaScript code


#3

Ok,
Suppose that I’ve created a variable in javascript code. Then how can I get the value of that in actions?
the following doesn’t work:


#4

“continue.VariableString(hello)” also don’t work.


#5

take a look here
http://wiki.compilgames.net/doku.php/gdevelop5/events/js-code
it says
Note that in the code, you have access to a variable named runtimeScene . The variable, “runtimeScene”, represents the scene being played.

I have never used jscript on gdevelop so I can’t help more


#6

I think you can do all that using the variables, conditions and actions of GDevelop. :blush:


#7

But how? can you please give an example?


#9

Search for “text” on this page:
https://gdevelop-app.com/game-examples-starters/

And read:
http://wiki.compilgames.net/doku.php/gdevelop5/all-features/variables