When this actor hits an actor

Greg

  • *
  • Posts: 1260
It's possible that this is a Stencyl related issue -- if the collision happens at the exact time when the animation is switching over -- something wonky could be going on here.  Ok now I gotta hit the road :)

Masked

  • Posts: 76
It looks like you were right, and this was a Stencyl related issue. I put a do after .1 seconds block around only the animation changes, and there's no more ricochet or collision glitches. It appears that changing an animation at the time of collision messes with the collision, even if the second animation has the exact same group and collision boxes.

Thanks for the help. I wouldn't have been able to figure this out on my own. I'll put you in the credits for debug.

Greg

  • *
  • Posts: 1260
No problem at all, I'll see if I can find a solution on the stencyl side. By the way, your game looks fantastic - can't wait to see the final product

Masked

  • Posts: 76
No problem at all, I'll see if I can find a solution on the stencyl side. By the way, your game looks fantastic - can't wait to see the final product

Thanks. :D

Greg

  • *
  • Posts: 1260
I looked at this a bit more tonight and here's my theory of what's happening.

1) Projectile fired
2) Enemy detects collision with projectile, *physics allows projectile to bounce off
3) Enemy changes animation to death animation (which does not collide with projectiles)
4) Projectile behaviors are processed.  Now normally, the behavior would check for a collision with an Actor and then kill the projectile (so you'd never "see" it bounce off in step #2).  But since the enemy behavior processed first, and the animation had changed first -- and now that the projectile doesn't collide with with the current animation of the enemy - no collision event occurs (and the projectile doesn't die).

I sort of verified this by setting up the "Untouchables" collision group to collide with projectiles and then they never seemed to bounce off.  Obviously this is undesired though since you don't want subsequent projectiles to stick into a dying enemy. 

I'm not sure what changes would be required on the Stencyl side to avoid this, so your best bet might be to keep the delay in for now.

edit: One solution might be to have the enemy actor kill off the projectile.  Check if the last collided actor is in group "projectiles" and then kill it. 

Masked

  • Posts: 76
I actually think the delay improves the animations aesthetically. It adds a lot of pop to the headshots. Therefore, I'm not going to tweak it any more. However, I'll be working on another type of enemy in the coming days that is faster and has more complicated death sequences that would be negatively affected by delays (dying in the air, etc.), so I'll try out your solution then. Thanks a ton. Stencyl has the best community for support, I swear.