EDIT: RapaGameZ found the issue, the problem has been resolved.
I’m pretty new to Gdevelop and I’m working on a puzzle game. The basic idea is, that the player taps on “LaunchBoxes” to launch “Flippers”. Flippers cover/uncover bits of a cat picture as they travel across the gameboard. Flippers are removed when exiting the play area, only 1 Flipper is supposed to exist at a time. Tapping on a LaunchBox while a Flipper exists does nothing. There are 4 different types of LaunchBoxes surrounding the playfield (Left, Top, Right, Bottom)
Everything is working as intended, but for some reason the LaunchBoxes at the top ignore the “Number of Flipper Objects = 0” check, allowing the player to create multiple Flippers (which breaks the game). On the screenshot below you can see I’m using basically the same code for the Top Boxes as the other three types.
Does anyone know why the Top Boxes might behave differently?
I tried everything I can think of to stop the player from generating multiple Flippers, but the Top Boxes continue being broken. Any help would be very much appreciated!
Are the Launchbox the same as LaunchBoxtop, I mean they are sprites with the same properties, objects variable, instance variables?
Yup, all 4 are completely identical sprites without any variables.
Try moving the among objects Flipper in your second events to the top
That way you first create the Flipper thing then create the EmptyLaunchBoxTop
Hm, that unfortunately didn’t help.
Remember that gdevelop reads events up to bottom. You delete launchBoxTop object before you create EmptyLaunchBoxTop at the position of launchBoxTop object. It can’t create that object in that position because launchBoxTop is deleted before. And same as the flipper you try to create at the deleted object position.
So delete object after creation.
The problem is that the instances of launchBoxTop will spawn Flippers even when a Flipper already exists. (all other launchBoxes work fine) The order of events sadly doesn’t affect this issue.
But that’s good thing to remember when creating and deleting objects. Can you send me the game file so I can look at the problem better? Send me a message.
I can’t find an option to message you. How do I do that? I assume you’ll need the sprites + game.json? Thank you for offering to look into it!