Bullet hitting multiple actors instead of one
VisualBasicC
Member Posts: 3
As the title says, I'm having trouble getting my projectile to hit only one 'enemy' actor instead of all of them when they are bunched up in a group.
Currently, I have a rule in the Bullet actor stating that if it collides with an Enemy actor to destroy itself.
I have a similar rule for the Enemy actor where it destroys itself if it comes in contact with the Bullet.
Problem is that when the bullet hits a few enemy actors that occupy the same space in my 2D world they all get destroyed instead of one.
I know I could set the enemy actors to collide with each other so that they would not overlap and be able to be in the same place as other enemy actors but I do want them to overlap and group together.
Would having them spawn in different layers solve my problem? Is there even a solution to my problem?
Currently, I have a rule in the Bullet actor stating that if it collides with an Enemy actor to destroy itself.
I have a similar rule for the Enemy actor where it destroys itself if it comes in contact with the Bullet.
Problem is that when the bullet hits a few enemy actors that occupy the same space in my 2D world they all get destroyed instead of one.
I know I could set the enemy actors to collide with each other so that they would not overlap and be able to be in the same place as other enemy actors but I do want them to overlap and group together.
Would having them spawn in different layers solve my problem? Is there even a solution to my problem?
Comments
Try this on the enemy actor:
When actor overlaps or collides with actor [bullet] AND attribute game.destroyable=true
timer after 0.1 seconds [check run to completion]
change attribute game.destroyable to true
change attribute game.destroyable to false
destroy actor
And then destroy the bullet actor when it collides with the enemy actor.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User