HOW TO: Ensure the sanctity of Actions?



  • Imagine an object with two Rotate BY behaviours, 30 degrees in each direction.

    A message receiver is hooked up. If the message received says Clockwise, that's what's done. A 90 degree rotation over 3 seconds.

    Similarly, a Counter Clockwise message initiates a 90 degree rotation for 3 seconds in the other direction.

    How do I ensure that one Rotate By finishes before another begins, regardless of when and what messages are received?

    Is there a way to queue the messages? Some other means of ensuring the sanctity of Actions?



  • @Deeeds you could have an array that stores the received messages, and then make a setup that takes the first value in the array(assuming you apppend the new messages), and based on the message, then triggers a rotate behavior. Then when the rotate has completed, get the array count and see if the array has any more messages, and if so, retrigger the setup. If not, then it stops.

    You would need to have the setup get triggered whenever a new index is added, but you would need to turn the “triggering” on or off based on if it is already running the setup or not. You could use behavior off when it starts, and behavior on when it finishes.

    Hopefully that make some sense lol



  • @iTap-Development Yes, makes sense, and is the same way I considered manually doing it. I'm wondering if there's a more natural, inherent and simpler manner of queueing actions.



  • @Deeeds yeah it was just off the top of my head...there is probably a better way, but i don’t have anything in mind right now🤷‍♂️


Log in to reply
 

Looks like your connection to hyperPad Forum was lost, please wait while we try to reconnect.