I am making an endless runner that has different instances spawn when you get close to a spawner. I am using Random In Range to spawn them.
One of these instances is a room that has an item, and I would like it for the room to not spawn again after you make contact with the item.
I would like the room with the item to be removed from the Random In Range list after making contact with the item.
I have tried adding a boolean that disables the room, and Im also looking into using Arrays but I dont really understand them.
The screenshots I am adding show the 4 instances that generate with the Random in Range spawner. As well as the code for the item in the room that I want to disable from the Random In Range options.
Thank you!
You can add layouts with an expression. So, if create an array with the names of the layouts then when the player collides with the target object then you remove that child from the array of layouts. When the array is empty then the player wins or advances or whatever. You can’t remove a child by name, you use the index. So, you either need to keep the index in a variable or use the find function in array tool or manually search using a for each child event to get the child’s index number.
My test used a button to add a random layout and a button to delete the layout.
Scene Variables
Events
If the goal object changes then you can add the goal objects to a group and check if the player collides with the group object.
Depending on the way your game works, you might need to add an object variable to the goal object with the name of the layout. You could then search and delete the layout child from the layout array either using the array tools extension to finfmd the child or a for each child event.