The Daily Click ::. Forums ::. Klik Coding Help ::. Multiple hit detection
 

Post Reply  Post Oekaki 
 

Posted By Message

Zi-Xiao



Registered
  29/07/2002
Points
  537

VIP Member
12th August, 2006 at 13:22:03 -

I'm trying to do a shotgun blast where each pellet deals 20 hp damage (out of 100).

My code goes if pellet collides with character, subtract 20 hp from character; simple stuff.

My problem is, when I fire the gun up close, MMF detects one bullet hitting the character and destroys all the bullets.

Any good solutions around this problem? And I'm not particularly enthusiastic about always running a fastloop through all the bullets on the screen.

Zi-Xiao

 
n/a

Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
12th August, 2006 at 13:48:36 -

Ready?

Bullet collides with enemy - Set Flag 0 on

Flag 0 on - Destroy.

 
Craps, I'm an old man!

Zi-Xiao



Registered
  29/07/2002
Points
  537

VIP Member
12th August, 2006 at 16:26:47 -

Doesn't work. I tried this in mmf1.5 and 2 btw.

 
n/a

Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
12th August, 2006 at 16:34:42 -

Try this one.

Only one action when event loops + Bullet is overlapping Enemy + Flag 0(bullet) is off

Set flag 0 to on.

 
Craps, I'm an old man!

Zi-Xiao



Registered
  29/07/2002
Points
  537

VIP Member
12th August, 2006 at 17:47:40 -

Nope, no good. I think mmf is interpreting it this way:

I create all the shotgun pellets at the same time and if I shoot while the barrel of the shotgun is overlapping the target, it'll detect that one of the pellets has hit the character, subtract the damage, but then instead of only destroying one pellet (or turning it's flag on), it destroys all the pellets (or turns all the flags on).

This is done in mmf2 so I'm really surprised I'm still having this issue. I'd have thought some of those nasty object focus/association issues would have been fixed.

I don't suppose theres an extension or something made to address this issue?

 
n/a

Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
12th August, 2006 at 18:03:25 -

Sorry, that should be "Pick one of" not "Only one action".

If that doesn't work, I don't know what to tell you; it's pretty much always worked for me.

 
Craps, I'm an old man!

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
13th August, 2006 at 21:58:20 -

Problem is they're all overlapping the character, and in that frame it has taken zero damage, am I correct? Best solution I can think of would be a fastloop that runs when a collision is detected, which checks and destroys each pellet and gives damage one at a time.

 
n/a

Werbad



Registered
  18/09/2002
Points
  235
14th August, 2006 at 09:54:06 -

Pellet overlapping character -> Do damage and kill pellet should work with multiple objects... It has always worked like that for me...

 
n/a

Zi-Xiao



Registered
  29/07/2002
Points
  537

VIP Member
14th August, 2006 at 15:24:16 -

Hmmm your idea still doesn't hold up Shab. Whats happening now is one or two pellets would hit and the rest would just fly through.

Although I tried to avoid it, it looks like a constant fastloop might be the only way to get this sucker to work.

Zi-Xiao

 
n/a

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
14th August, 2006 at 23:08:05 -

If you go with a fastloop, it doesn't need to run constantly, only when a colission is detected and only until all pellets have been checked.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click