Don’t put beginning of scene inside a repeat event. Put the beginning of scene condition in its own event and then hang the repeat events off that as sub events.
That timer check is not a subevent of the repeat event. They are separate and unrelated events. The repeat does not have any influence on the one immediately after. So the actions of the event are performed on all the objects that meet the conditions, and any values set are all the same.
Change the events around you filter the objects first with conditions then use the repeat over the selected object. It should look like:
Thanks for responding - that did make a difference.
However, now spawned objects aren’t deleting/reseting until every available sill has been populated (about 20 seconds in), at which time all spawned objects delete at the same time and window sills begin to respawn again.
Also, only one object from both the snacks group and the spooks groups are spawning. Like only an apple, when I’d expect to see 4 other snacks, and one person, when I’d expect to see 4 other person-sprites. I suppose I can duplicate logic for each individual spawned object when it’s finally working, but I was trying to simplify by grouping.
Yes, because you are resetting the timer “LifeTimer” of the all the object in the group because you don’t have a condition to filter which group member to apply the timer reset:
so GDevelop applies it to all of the group objects. If you want to only apply it to the object created, then you’ll need to move the reset timer to after the create object action.
That’s because you are using the action “Create object SpooksGroup at position...”. So it creates the first object from that group. You want to use the “Create an object from it's name” action. This may require a slight rework of your objects, depending on how you’ve named them
is not the most efficient way or the best practice for using repeats. It may not have an impact right now, but if you get into larger games it may be the difference between a smooth and a stuttering game. Reduce the number of objects first, then repeat over the filtered list:
One new thing now is that 2 or more snacks are spawning at the same window sill at the same time, and same goes for spooks. It’s fine for a snack/spook to simultaneously occur at the same location, but not snack/snack or spook/spook.
I thought the condition: “The variable hasSnack of WindowSillRight = 0” would prevent multiple snack spawns in the same location, but that doesn’t seem to be the case.
you are resetting the hasSnack and hasSpook variables, but you are not specifying which WindowSillLeft or WindowSillRight it’s for, so GDevelop will be doing it for all of them.
I suggest:
You put WindowSillLeft and WindowSillRight into an object group named “WindowSillGroup”.
Add a condition to check for collision between SnackGroup and WindowSillGroup to the first event.
Move the “Delete SnackGroup” action to the first event.
To the first event also add an action to set hasSnack of WindowSillGroup to 0.
Remove the repeat for each instance event.
You can do without the repeat event here because the actions to delete doesn’t take any object specific or unique values. And the changing of the variable is to the same value for all the WindowSillGroup objects.
Snacks are now spawning correctly as the game progresses, but for some reason Spooks stop spawning after a dozen or so seconds. Seems like it must be because they’re not resetting properly, so they spawn once and never again. But the logic of both are identical, I believe.