Why isn't collision always being detected? [SOLVED]

Omniso

  • Posts: 192
Basically I have an issue where when a projectile hits an enemy it's HP is decremented until 0 (dead). During a test run I've noticed several times that a single enemy actor in particular (every other enemy has the same exact code in the screen-shot and always take damage) would survive a LOT longer than normal under focus fire. Had its HP displayed the next run and I realized that it was only taking damage half the time for some reason. . . The projectile that hit the enemy was indeed colliding but its HP was only being decremented every 2 to even 7 shots or sometimes just every shot. Once more It's completely random and it's only occuring on THIS actor despite it having the same collision and member group of other enemies. There isn't anything wrong with the code given is there? Or is it just a collision box issue?

« Last Edit: October 13, 2016, 01:12:10 pm by Omniso »

Hectate

  • *
  • Posts: 4645
Are your projectiles sensors? It occurs to me that maybe the collision isn't caught because the projectile "bounces off" of the enemy (e.g. stops colliding) before it has a chance to run it's own collision code. Typically I prefer to have all the code for a collision happen in one place (easier to work with when you can see it at once), so I'm not even sure if that's possible - but it's a thought.
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

Omniso

  • Posts: 192
Yes, they are sensors. If the projectile stops colliding at the very moment of impact could be causing this how would I go about fixing that without causing all projectiles to hit ships for possibly 2-10x damage? (If the projectiles don't stop collision immediately after impact enemy ships will continue to take damage from each one) Also, why is it that this issue is only happening on one actor? Just recently did a test after what you said and had 50 projectiles thrown at two different enemy actors (with the same group and collision group), one enemy actor took all 50 and the enemy actor I'm having a problem with only took damage from 27 of them.

« Last Edit: October 13, 2016, 12:11:05 pm by Omniso »

letmethink

  • *
  • Posts: 2545
Swap the animation of the projectile in the behaviour for the enemy. This means that it is assured that it collides once.
~Letmethink

Omniso

  • Posts: 192
Thanks for helping me with this issue.