Creating many instances of my object

Hello all,

I’am new in Gdevelop and I’m wondering how can I do fill my layer with many instances of the same game object. For example by adding a action in the beginning event.
In more details : I want to fill my layer with rows and columns of tiles (one tile has a size of 9px per 9px).

Thank you in advance for your help :slight_smile:

Hi and welcome :slight_smile:
You should put a repeat event inside a repeat event.
One repeat takes care of lines, the other takes care of columns.
You will need to use variables to tell where the objects should be placed (and reset at the end of a line/column).

And since you’re new: Note that if the objects/floor is only visual, you shouldn’t bother with that. Use the tiled object.

1 Like

Thank you Gruk.
Repeat event was the key I needed :slight_smile:
But I have a issue : the repeat event continues the loop even if my number of times is reached (I put only 2 actions : create object and increase variable)
Do I have to put something at the end of the repeat event to stop the loop?

1 Like

The events are repeated 60 times per second unless instructed otherwise.
You may place your repeat loops inside a parent event with the condition “Trigger once” or “At the beginning of the scene”.

1 Like

Yeah it’s working now by using “Trigger once” in a top level.
I have to confess that I had forgotten this notion of refresh…

Thank you a lot for your time and answer! :+1: :slight_smile:

1 Like