Lets say I've got 20 bullets. I've spread a value in A and I'm using a fast loop to move them. When They collide, I destroy them and make some spark objects.
Here's whats happening:
I shoot 20 bullets. One of the bullets collide with a wall. The bullet which hits the wall is destroyed and sparks are made at that bullet. However, sparks are also created at ALL OTHER bullets. But all those other bullets are NOT destroyed.... W T F ?!?! The 'destroy' and 'create spark' actions are on the same event/line. How does this work?
Zi-Xiao
n/a
DaVince This fool just HAD to have a custom rating
Registered 04/09/2004
Points 7998
12th November, 2007 at 14:49:20 -
If you have the specific bullet selected in your conditional (like "bullet value = loop value" and then "create spark at bullet"), it should create sparks only near that specific bullet. Perhaps you're creating sparks somewhere that's not part of that bullet selection, and thus will select ALL bullets?
Negative. The only event which creates sparks is when the bullet hits a wall. Here's what the event looks like:
On Loop "bullet"
+ Alterable Value A of Bullet = loop index of "bullet"
THEN
start loop "move bullet" for Alterable Value B (this is the speed) of Bullet times
On Loop "move bullet"
+ Alterable Value A of Bullet = loop index of "bullet"
+ Bullet is overlapping a background
THEN
destroy bullet
create sparks
The first loop basically loops through ALL bullets. And for EVERY bullet, the first loop will start a second loop to move the bullet. For Example
DaVince This fool just HAD to have a custom rating
Registered 04/09/2004
Points 7998
12th November, 2007 at 16:10:03 -
Ah, I see. You try to create the sparks after you destroy the bullet, right? Create the sparks first, then destroy the bullet, or you'd lose the selection too soon (since the object doesn't exist anymore).
I don't have my program in front of me but I'm pretty sure I have "create sparks" before "destory bullet". I didn't really pay attention to the order when I was typing up all that.
If you don't mind, I could send you a copy of the mfa.
n/a
DaVince This fool just HAD to have a custom rating
Registered 04/09/2004
Points 7998
13th November, 2007 at 09:14:52 -
Hmm, weird. Should work, then. Just post the mfa here (preferably without extensions since I only have the MMF2 demo)?
OMFG, this is retarded beyond belief. I played around with the code a bit and here is what I found.
On Loop "move bullet"
+ Alterable Value A of Bullet = loop index of "bullet"
+ Bullet is overlapping a background
THEN
create sparks
destroy bullet
Stop loop "move bullet"
----------
This will make sparks at ALL bullets when a single bullet hits a wall. Like before, only the bullet which hits the wall will actually get destroyed. All the other bullets will not.
On Loop "move bullet"
+ Alterable Value A of Bullet = loop index of "bullet"
+ Bullet is overlapping a background
THEN
Stop loop "move bullet"
create sparks
destroy bullet
----------
This will make sparks at ALL bullets when a single bullet hits a wall but will destroy ALL bullets.
I think this may be a problem for clickteam rather than the forums. I'll post a link to the game anyways when I have a chance to upload it somewhere.
You don't even need the 'Alterable Value A of Bullet = loop index of "bullet"' bit... as "bullet overlapping background" filters the bullet you want to create the spark at, try removing that condition..