Hit Area
quinn221
Member Posts: 280
I have a enemy who is an animation...and it has a lot of white space to the left that is part of the animation but not the enemy itself. So when my actors sword collides with it, it can kill him even for a far distance because the white space is part of the animation. I thought I had it figure you by constraining a hit area to the actor. With this I ran into two issues.
- The hit box will not move with the animation ( not sure if this is possible)
- After I kill the enemy all other enemy of this type die as well (using a game health attribute)
Any Suggestions
Comments
You could constrain the position of the hit box to the player's position.
Are you destroying the hitbox after the player is done attacking?
Is it a global or self health attribute?
@RabidParrot Not sure that would help, If I constrain it to the players position, as soon as I attacked it would kill the enemy, even though I would not be touching the enemy.
Global...Since the hit box death will kill the enemy..2 separate actors
@quinn221 Try using self health attribute on the hitbox, destroy the hitbox when self.health <= 0 , when the enemy no longer collides with the hit box destroy the enemy.
So let me get this straight. You have a global health attribute that reaches zero when the hit box and enemy collide.
When the global health attribute is 0 the enemy gets destroyed.
Which goes for every other actor that get destroyed when the global attribute is 0.
Ok, I think I might have explained this wrong. The main concern is my animation. My animation is of a large killer flower that lunges at the hero, then lunges back. During the back state the animation has about 70 pixals to the left. So if my actor attacks during the lunge back state he can still kill the enemy even know he is not touching him.
Ok, now if I put in a hit box it don't really help because all I have to do is walk up to the hit box and kill it...and when the enemy is attacking me it won't hurt me because the collide behaviors are on the hit-box.
Is it possible to constrain the hit box to the animation frames, or follow the animation?
The other issue is...
I have a global attribute that says when hitbox = 0, kill the flower, but if I have any other flowers in the game they died as well.
I know this is confusing...I hope it makes sence
You could change global attribute to self attribute. It will only destroy self.
@gattoman but how do I control a self attribute from another actor... Hit Box and Enemy are separate... The death of the hit box kills the enemy
I see what your saying. Are there a lot of these actors? Each enemy could have a unique hitbox and unique attribute.
Enemy 1. Hit box 1.
If hit box 1 dies then enemy 1 destroy.
May not be practical if lots of enemies.
I think this will work!!!
@Icebox1910 Thanks it worked.!!!!