Is There an "On Created" Condition?

In my game, I spawn hordes of enemies from all directions. These are all part of an object group, “Enemies.” I am trying to spawn a secondary sprite, “glow” that attaches to the first object. I have tried the “sticker” behavior, I have tried “put the object around another” and “put around a position” actions. There are many different effects that happen. Sometimes the glows fly around seemingly randomly, sometimes they hop from one instance of “enemies” to another. I was thinking that if I could use the sticker behavior at the moment of their individual creation, that it might work. I also need to roll a random variable to determine if each is a certain type of boss and thought it would be easiest with an “on created” condition.

Sorry I’m so confused and thanks for any help.

I use (most of) the formula from the Pin object to another (single not multiparent) example in GDevelop to pin objects in a relative position to another object in my project and it works fine. If doing this though I’ve had best results setting the Origin point at the center of my sprites but maybe that’s just my project.

You can see here right after I create the item and set what position I want it to have, I then set up the variables as in the Pin Object to Another example, then under that I have an unconditional Put recipes around placeholder and the formula from that example. Although you can put conditions too.

Maybe it will help.

I just thought about it maybe if you use the sticker behavior right after creation it will do the same thing? Not sure haven’t tried it.

Also, anything you tell an object to do after creating, like that above where I’m changing the position of each object after it’s creation, that is the on creation condition. GDevelop just knows you’re talking about the object you just created.

2 Likes

Are you using the Spawn behavior? I know there’s a condition that tells you when something is spawned but unfortunately I don’t think it “picks” the objects like a collision condition. That would be nice. It does link the objects to the spawner as a way to keep track of how many are in the scene. That might also be useful to check.

The behavior could be modified to add multiple objects and stick them. Or you could track new objects with an object Boolean and the spawner’s “object was spawned” condition.

When the spawner adds an object check an object boolean variable, if it equals false then set it to true and add the 2nd object, stick them together or whatever else. You can use either the group name or individual objects.