Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Fat Pug Studio 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?
-
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.
-
Yeah, but won't the collider on the explosion trigger with only one enemy?
-
A-ha, i should cast overlap sphere, i'll check that out.
-
Nope u can collide/trigger with 1000 object by default within a frame.
-
I can't get it working with neither ArrayListFindGameObjectsInsideCollider2D nor ArrayListCastOverlapSphere, any ideas on properly setting these up?
-
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.
-
ArrayListFindGameObjectsInsideCollider2D needs to have mesh renderer on itself, trying out the List Game Objects Inside Collider 2D.