problem with change and state

Get help using Construct 2

Post » Mon Mar 30, 2015 10:31 pm

this is the code i have.
Image

what it does is when the enemy collides with the player attack he goes into a "takingDamage" state.
when he enters the "takingDamage" state, i run once a tint on the enemy and after 1 second untint him and then exit the taking damage state by setting "takingDamage" to false.
as soon as "takingDamage" is false he goes back to walking, being idle, etc.

the problem is that if he gets hit again right as he is getting out of the "takingDamage" state (a specific moment between events maybe? where code hasnt been completed yet?)
he sets the "takingDamage" to true again, but just stays stuck there, without running anything inside the "is takingDamage".
since he doesnt run anything inside this condition he will be stuck there forever. (never setting "takingDamage" to false again)

any ideas?
Image
B
19
S
5
G
2
Posts: 63
Reputation: 1,645

Post » Mon Mar 30, 2015 10:45 pm

The "Trigger Once" event has (something like) a 10-second reset period. If your events are triggering faster than 10-seconds per event, only the first one will trigger.
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,307
Reputation: 4,608

Post » Tue Mar 31, 2015 1:16 am

i switched the order of the 2 conditions, putting the "is takingDamage" before the "X is takingDamage".
this seems to have solved the problem. cant seem to reproduce the "bug" anymore.

anyone care to explain whats up??
Image
B
19
S
5
G
2
Posts: 63
Reputation: 1,645


Return to How do I....?

Who is online

Users browsing this forum: Marcos12, nanogod and 9 guests