Using the ‘For each’-event is definitely the right thing to do but first you have to link the bulletspinner and the bullet. In the ‘For each’- event you have to take the two linked objects into account.
I just posted an example on how that works for another post yesterday, but the actual method is the same.
I can’t believe it worked, you’re a miracle worker!
The bullets are now spiraling appropriately! I even went ahead and used this philosophy to make the other guys play nicer with each other, and now nobody is stealing anybody else’s bullets anymore!
I decided to make this more customizable, by adding the ability to shoot different amounts of bullets and adjust their rotation speeds too with instance variables.
Although, that’s where I’ve encountered a problem…
When I set the rotation speeds and distance speeds of each guy, all guys with the same state instead just share whichever one has the biggest instance variable. For example:
(The GIF is crap, I know, but trust me, they're spinning)
The instance variables are bulRotSpd (Rotation speed), and bulRotDist(Speed of the outwards spiral).
Guy on the left: bulRotSpd = 200 / bulRotDist = 0.090
Guy in the middle bulRotSpd = -50 / bulRotDist = 1
Guy on the right: bulRotSpd = 10 / bulRotDist = 0.001
However, all guys are rotating at 200 speed, and 0.090 distance. How can I prevent them for sharing their instance values?
Use a repeat for each guy as a subevent of the first event from your screen snip. As it stands you could have mulitple guys that meet the conditions, and it’s anyone’s guess which guy’s values gets used.
Nvm, I’ve once again found out a solution. I just needed to link the guy and bulletspinners too.
Now they’re rotating perfectly, and it’s very customizable as well.
Sorry to be a bother, but there’s one last issue…
For this, I’m going to unhide the bulletspinners to demonstrate:
The bullets have the Destroy Outside of Screen behavior, and when the bullet is deleted, you can see that some of the spinners are stopping in place if you look closely.
What I want is for the spinner to be deleted with the bullet to prevent a data overflow, but my code doesn’t delete them:
Ah, okay I missed that point. I am just guessing but I would try another ‘For each’-event when you check for the bullet position and destroy the spinner.
The general problem here is that the bullet is deleted and then the bulletspinner which is linked to the bullet should be deleted as well. But if the bullet is deleted first there is no link anymore. I would suggest to delete both at the same time.
This is how it works for the example (I changed the names, the screenwidth and height / 1.5 is just for me to see that both objects are deleted).
I had to modify the code a little bit, switching the bulletspinner in position to bullets, and I changed the values of offscreen to my liking, but I can confirm that it’s definitely working now! Thank you for your help!