Activating component after some time

You can enable and disable sprites and other components by posting a message to the components.

You can achieve a delayed function call in many ways:

  1. Use a timer module of some kind. One example is presented in this post: My sleep() function freezes whole game, ideas? (SOLVED)

  2. Use go.animate on a dummy property:

    go.property(“timer”, 0)
    go.animate("#", “timer”, go.PLAYBACK_ONCE_FORWARD, 0, go.EASING_LINEAR, 4, 0, function()
    msg.post("#sprite", “enable”)
    end)

1 Like