playMaker

Author Topic: Logic help on splash damage  (Read 2073 times)

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Logic help on splash damage
« on: April 11, 2018, 08:26:12 AM »
Hi guys,

i want to make some explosions have radius based damage that can damage multiple enemies, but my current bullet/enemy/damage setup is giving me a hard time.

At the moment, all the damage dealing stuff is set up like this:

  • Bullet hits the enemy
  • Bullet takes the current HP from enemy, deducts the damage it is making, and feeds back the new HP to enemy
  • Enemy checks if HP is 0, if it is, it dies, if it is not, goes back to idle state

It can be simpler, but i have many modifications that makes it necessary to work this way.

Splash damage is easy to implement from the enemy side, as every enemy can detect the collision with the explosion collider and apply damage to itself, but since the logic of dealing damage in my case is on the bullet/explosion side, only the first enemy that collides with the explosion will be hit, and rest will remain undamaged.

Any ideas on this one? Some spherecast with adding enemies in the blast radius to an array and the cycling through all of them?
Available for Playmaker work

CookiMonster

  • Playmaker Newbie
  • *
  • Posts: 9
Re: Logic help on splash damage
« Reply #1 on: April 11, 2018, 09:41:12 AM »
It would be easy to do it with array. After the trigger hits use the "array add" and to send the deal dmg event use the "array get next" action. This have to happen within one frame to all enemys inside the trigger.

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Logic help on splash damage
« Reply #2 on: April 11, 2018, 09:50:11 AM »
Yeah, but won't the collider on the explosion trigger with only one enemy?
Available for Playmaker work

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Logic help on splash damage
« Reply #3 on: April 11, 2018, 10:41:29 AM »
A-ha, i should cast overlap sphere, i'll check that out.
Available for Playmaker work

CookiMonster

  • Playmaker Newbie
  • *
  • Posts: 9
Re: Logic help on splash damage
« Reply #4 on: April 11, 2018, 03:04:41 PM »
Nope u can collide/trigger with 1000 object by default within a frame.

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Logic help on splash damage
« Reply #5 on: April 11, 2018, 03:06:52 PM »
I can't get it working with neither ArrayListFindGameObjectsInsideCollider2D nor ArrayListCastOverlapSphere, any ideas on properly setting these up?
Available for Playmaker work

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Logic help on splash damage
« Reply #6 on: April 11, 2018, 03:13:03 PM »
Nope u can collide/trigger with 1000 object by default within a frame.

Yeah, but how to loop through all of them and don't repeat what's been hit? I tried with get trigger info and the object hit and then add to arraylist, but they all have the same name, so only one is added.
Available for Playmaker work

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Logic help on splash damage
« Reply #7 on: April 11, 2018, 03:25:08 PM »
ArrayListFindGameObjectsInsideCollider2D needs to have mesh renderer on itself, trying out the List Game Objects Inside Collider 2D.
Available for Playmaker work