playMaker

Author Topic: Trying to make an explosion destroy objects around it  (Read 2609 times)

blake3d

  • Playmaker Newbie
  • *
  • Posts: 8
Trying to make an explosion destroy objects around it
« on: May 31, 2015, 12:05:35 PM »
Hello, I am relatively new to this and am struggling with something that I feel is probably simple.  I have a game object that falls into a scene and causes an explosion after a set time.  I would like it to destroy other objects close to it by its force, what should I be setting up on the other game objects to detect the explosion and destroy itself? 

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Trying to make an explosion destroy objects around it
« Reply #1 on: May 31, 2015, 11:45:58 PM »
I do this by having the bomb object tagged "explosion"- when it explodes it uses a send event "Broadcast all" of "explosion"- then the objects that can be damaged by it have a global transition/event called "explosion"

So when the object explodes it sends that event- then when the objects receive it they measure their distance between themselves and the object that sent the event- I use the distance with a float compare to decide if they should be damaged or not- works really well
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

frozze

  • Playmaker Newbie
  • *
  • Posts: 25
Re: Trying to make an explosion destroy objects around it
« Reply #2 on: June 01, 2015, 09:50:35 AM »
I do this by having the bomb object tagged "explosion"- when it explodes it uses a send event "Broadcast all" of "explosion"- then the objects that can be damaged by it have a global transition/event called "explosion"

So when the object explodes it sends that event- then when the objects receive it they measure their distance between themselves and the object that sent the event- I use the distance with a float compare to decide if they should be damaged or not- works really well

Could you post your example here, so I could play around with it? It's exactly what I'm looking for :)

blake3d

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Trying to make an explosion destroy objects around it
« Reply #3 on: June 01, 2015, 08:18:27 PM »
That worked like a charm, thank you!

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Trying to make an explosion destroy objects around it
« Reply #4 on: June 01, 2015, 10:55:12 PM »
That worked like a charm, thank you!

I'm glad it helped  :)
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

sturmburg

  • Playmaker Newbie
  • *
  • Posts: 12
Re: Trying to make an explosion destroy objects around it
« Reply #5 on: June 02, 2015, 01:27:19 PM »
Would it be possible to see the example of this implementation?  Sounds like it might  be more efficient than the way I'm doing it now.

Thanks