Ask here your questions to get help using GDevelop.
By Patryk
#68074 Hello everyone, Im new to this thing.
I created 4 subevents which cause the walls of my level to go back and forth. They do so twice or so but after they stop. I tried looking but is there a way to repeat previous actions like loop it in some kind?

So if I have the block move 50p/s and then -100p/s, repeated twice, is there a command I can imput so it keeps repeating those actions so the wall will "infinitely" repeat its back and forth action.

Thank you,
Patryk :)
User avatar
By ddabrahim
#68075 What I would do is simply take a note of the initial object position and store it inside an object variable.
And then check the position of the object and move it according to if it position is greater or less than the initial position

I have just created an example, you can download it from here:
https://gametemplates.itch.io/gdevelop-examples

It is at the bottom, move-object-back-and-forth that is.

If you want to control how many times you want to move the object back and forth, you can put the event in to an external event and call it under a Repeat event, in that case the event is going to fire only as many times you specify in the Repeat event.