How do I have multiple copies of one object with a different value

I am making this rogue-like-ish game and on the title screen i need to have multiple passenger carriages pass through, however I can’t figure out a way to make them be seperated so the animation looks good, however I also don’t want to copy-paste the object with a new name. Is there anything I can do?

I’m not sure if it’s what you’re looking for but Gdevelop has instance variables. Click on an object and under the properties tab, at the very bottom, you’ll be able to see 'em.
They can be added in two ways.
1.) By clicking “add instance variable” in the properties tab. This’ll make just one variable for the specified object.
2.) By adding an object variable and then editing said object variable in the properties tab. This’ll make every single object have a default value of that variable, but you can change the value of some specific objects.

Then all there’s to do is "if object.variable(“instanceVar”)==“someTag”, and there you have it. I think…

Toodles!

How do I make sure that the GDevelop knows which object has which variable though? Because at the moment it just makes them all move at the same time.

You would target it in the conditions. So, for example, something like:

The text of variable VARIABLENAME of Carriage = "textofvariable"
or
The variable VARIABLENAME of Carriage = 4 (or whatever number you want)

Then the action for that event will only happen to the carriage with that variable/value.

2 Likes

Thanks a lot, this works perfectly as I imagined it!

(Also here is a copy of the script for anyone who needs it.)