Deleting the first platform when creating a new one

Hi! In my platformer, there is a level with a small puzzle - to go further, you need to build a path in front of yourself. I want to put a restriction that after 2 platforms have been built, when creating the third one, the very first one is deleted.

I tried to implement this through the function of selecting the nearest platform, but this is not what is needed. I wanted the platforms to be removed according to the queue, as they were built. When trying to create a branch of events by deleting and adding a trigger box , all events were played at once :frowning:

Do I need to set variables here? I’m a newbie at Develop and I don’t want to over complicate the code :pray:

Here’s a way to do it. Add a variable to Platofrm1 named orderNum, and a scene variable named currentPlatformNum.

Then use the following events to get what you’re after. The magic is with the mod function - it sets currentPlatformNum to the remainder when you divide currentPlatformNum +1 by 2.

I recognize well here a programmer! (modulo function)