"=" block not working well?

ChristianEs

  • Posts: 226
look at the picture attached, i want that when this actor hits another actor then that the attribute number called "hit" decrements by 1 and when it reaches 0 the actor dies
but when i hit the actor 1 time and goes to "2" (as seen with "print hit" on the flash player) the actor dies it doesnt even reaches "0"

also another weird thing is that if i put for example on the always block "if hit = -10" the counter  goes down like five numbers not 1 when i hit the actor


rob1221

  • *
  • Posts: 9424
Collisions are checked every frame so the "hit" attribute is decrementing every frame.  You'll need to use conditions to stop that from happening.  One way is to use a delay that ignores collisions during that time period.  Another way is to stop checking collisions after the first until the objects are no longer colliding.