Behavior changes when clicked and not clicked

My intention is to click on the message and then click again to delete the message. So I put an infinite repetition block, but only once. what is the reason?!2018-04-12 21;45;19

Hi Jeongmin!

To toggle between two different onActivate events, you can place them into functions to change the behaviour whenever the man is clicked.


Show code in action

How the code works

  • The function bindSpeakOn creates an onActivate event for man-item. When the man-item is clicked, the man says something and the function bindSpeakOff is triggered.
  • The function bindSpeakOff creates an onActivate event for man-item, which overwrites the previous onActivate event. When the man-item is clicked, we remove the phrase and the function bindSpeakOn is triggered.

Outside of the two events we place one bindSpeakOn function block to set the first event when the scene starts.

I hope that this code can help you!