The Daily Click ::. Forums ::. Klik Coding Help ::. MMF2 object focus/selection fubar
 

Post Reply  Post Oekaki 
 

Posted By Message

Zi-Xiao



Registered
  29/07/2002
Points
  537

VIP Member
12th November, 2007 at 14:11:08 -

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

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
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?

 
Old member (~2004-2007).

Zi-Xiao



Registered
  29/07/2002
Points
  537

VIP Member
12th November, 2007 at 16:05:46 -

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

Bullet 0
Move bullet 0
Move bullet 1
Move bullet 2
.
.
.
Move bullet 40

Bullet 1
Move bullet 0
Move bullet 1
Move bullet 2
.
.
.
Move bullet 40

Bullet 2
Move bullet 0
Move bullet 1
Move bullet 2
.
.
.
Move bullet 40

Bullet 3
Move bullet 0
Move bullet 1
Move bullet 2
.
.
.
Move bullet 40

etc.

 
n/a

DaVince

This fool just HAD to have a custom rating

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
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).

Image Edited by the Author.

 
Old member (~2004-2007).

Zi-Xiao



Registered
  29/07/2002
Points
  537

VIP Member
12th November, 2007 at 23:29:32 -

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

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
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)?

 
Old member (~2004-2007).

Zi-Xiao



Registered
  29/07/2002
Points
  537

VIP Member
13th November, 2007 at 14:15:51 -

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.

 
n/a

Klikmaster

Master of all things Klik

Registered
  08/07/2002
Points
  2599

Has Donated, Thank You!You've Been Circy'd!VIP MemberPS3 Owner
13th November, 2007 at 14:49:18 -

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..

 
n/a
   

Post Reply



 



Advertisement

Worth A Click