Stop dynamic object creation and reactivate it

Can anyone give me an example?
How to stop creating a dynamic sprite in the middle of a game, and reactivate it
what is the condition?

You mean Action to disable Physics2 Behavior?

Set as Static
Set as Dynamic
or
Deactivate Behavior yes / no

I did this before, but I do not want it to appear on the screen at all. It should be like deleting. When I want to reactivate it, it will return.

In the same Action use Hide and Show your Sprite.

I did it before … but it doesn’t work because it interfered with some work.
But if I can stop object creation, that’s fine. I will create a new design similar to the old one but with a different name upon reactivation.
But the question remains how can I stop creating an object? but I think it’s not an available option.

Can you share a picture of your current events? There seems to be some vagueness about what you’re trying to do.

If you’re trying to pause a spawning action then I’d add a boolean variable and switch it between true and false to start/stop spawning. Your need might be different so you could use any condition(s) to trigger the spawning.

If you just want to stop an object then again, you could use a boolean or delete it or disable a behavior or hide it.

I think right now we just can’t see your intentions. There’s very little that can’t be done in Gdevelop.

Yes it’s what I want
I just have a little experience with some of G-Develop’s options
Thank you very much

If you’re using the spawn behavior/extension then you can disable the spawn behavior on the spawner object. You don’t necessarily need to stop the spawn action but disabling the spawner only stops the timer. It still runs code on each frame; it just doesn’t spawn objects. It’s just my preference to also stop that part as well.

In this example pressing 1 enables the spawner and pressing 2 disables it.

If you’re not using the spawner behavior then you can use a Boolean variable to trigger it.

FYI, the spawn behavior also lets you set a maximum spawn object count. Its default value of zero means there’s no restriction. Setting it to 5 in either the behavior setting or through an action would ensure that there are only 5 spawned objects at a time. It counts all objects attached to that spawner including ones off screen. So, if they’re no longer needed as always don’t forget to delete them.

1 Like

Thank you
This is really amazing
I didn’t know this existed, this would modify so many ways my game :face_with_monocle:

1 Like

You’re welcome.

Which part are you referring to? Just out of curiosity.

object spawner extension.
The ability to control the spawners’ number

1 Like