This is what I did to make this happen, I made it where it create multiple objects to multiple rotating objects. I’m pretty sure I’m on the right track.
But, When I make it change positions, This happens, Why does it do that?
How can I make this work as I intend?
Hi, generally you are using too many ‘for each’ events. That’s not only unnecessary, it also can affect the performance of your game.
Since your “SpikeyFlyingThing”-objects are each attached to a specific point on “SpikeSqure” you should create them all in one event. If you have two “SpikeSqure”-objects as in your screen you need to use a “for each-event”. After creating a “SpikeyFlyingThing” -object, you need to link each of them with the “SpikeSqure”. This would for example look like this:
For moving the “SpikeyFlyingThing” -objects you need a separate event that takes into account all “SpikeyFlyingThing” -objects linked to “SpikeSqure”. Since you have more than one “SpikeSqure”, you have to use a “for each” event again. That could look like that:
You’re not specifying which SpikeyFlyingThing, SpikeyFlyingThing2, SpikeyFlyingThing3, and SpikeyFlyingThing4 to link. So it links them all to every SkpikeSqure object. And the last one they are linked to will be the one they get drawn against.
I see. I’ll work on that.
Okay, It works. But it does lag/slow downed the game. Anything I can do about that?
Looking at the name of your scene (Level21) I assume that you have a larger project. I do not have any experience with that, but I assume that the two “for each”-events are not the sole reason for lagging. This post has some useful information and suggestions what you could do:
Have you got the repeat and create events as subevents of a “Beginning of scene” or “Trigger once” event? Otherwise it’ll be creating new objects every frame, and that will cause lag and eventually a game crash or complete stop.
Do you mean these, or all events (like events for Players, Enemies, etc.)?
This event (and subevents) definitely need to be subevents of a “beginning of scene” or “trigger once” :
However, I suggest that rather do all this work yourself, use the Sticker extension. You add the extension to the project and add the sticker behaviour to the SpikyFyingThing objects.
Then is a simple matter of positioning the objects at the beginning of the scene, and Sticking them to the SkpikeSqure. And that’s it. The extension does all the work of rotating the object correctly and placing them in the correct position.