As part of a real-time battle system, I have enemies (events) who have various pages which form a kind of state machine.
Page 1 is what happens when they spawn
Page 2 is their behaviour while they are alive
Page 3 is their behaviour when they die & despawn
The 2nd page above is a parallel process, as the logic each enemy is largely self-contained (they evaluate the situation and make decisions about what to do based on some simple conditions).
However, I also want the player to take damage if they touch an enemy.
I can't just have an "event touch" page, because obviously if that's to the right of the parallel page, that'll take precedence and page 2 won't work correctly.
I know I could do some logic to get the position of the event in Page-2 and compare it to the player's, but as I'm using pixel movement, that'll be complex as I'll need to work with the realX/realY of the characters.
Basically, I'm just asking, before I go down that route - is there any way to have an Event Touch page to the right of a Parallel page, which only activates upon touch?
EDIT: Realised that might get messy because I've got multiple enemies performing the check each frame, so I would have to do the entire thing as one script statement or they might happen on top of each other, "stealing" each others' variable data.
Is there no function I can call, e.g. checkTouch(player ID, event ID) to do this?
Page 1 is what happens when they spawn
Page 2 is their behaviour while they are alive
Page 3 is their behaviour when they die & despawn
The 2nd page above is a parallel process, as the logic each enemy is largely self-contained (they evaluate the situation and make decisions about what to do based on some simple conditions).
However, I also want the player to take damage if they touch an enemy.
I can't just have an "event touch" page, because obviously if that's to the right of the parallel page, that'll take precedence and page 2 won't work correctly.
I know I could do some logic to get the position of the event in Page-2 and compare it to the player's, but as I'm using pixel movement, that'll be complex as I'll need to work with the realX/realY of the characters.
Basically, I'm just asking, before I go down that route - is there any way to have an Event Touch page to the right of a Parallel page, which only activates upon touch?
EDIT: Realised that might get messy because I've got multiple enemies performing the check each frame, so I would have to do the entire thing as one script statement or they might happen on top of each other, "stealing" each others' variable data.
Is there no function I can call, e.g. checkTouch(player ID, event ID) to do this?