[Behavior] duration

0 favourites
  • 11 posts
  • Document, plugin and sample capx are included.

    It is used to "run trigger every X second, persist Y second", or "turn on the switch, then turn off after Y second".

  • I try to download updating your repository of c2

    and see a lot user upload also him plugins and Behavior

    but I not see this

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • felixsg

    This behavior is named "rex_duration" in behavior list.

  • Update:

    • Fix bugs.
    • Delete timer after duration finished.
  • Duration behavior

    (Update: 2012/06/16)

    The idea of this behavior was came from

    "Duration behavior" is a timer-like behavior. It will execute callbacks during duration. Like timer behavior, duration need to connect to timeline plugin and function plugin.

    See sample capx for more detail.

    <img src="http://i1081.photobucket.com/albums/j352/rexrainbow1/screen1-28.png" border="0">

    Left side is the setting of duration:

    Duration time = 1 second : start at 0, end at 1

    Interval time = 0.3 second : intervals for each 0.3

    Right side is the execution result:

    0 -> execute callback "start"

    0.3 -> execute callback "interval"

    0.6 -> execute callback "interval"

    0.9 -> execute callback "interval"

    1 -> execute callback "end"

    Set callback to "" (empty string) could skip this callback.

    This is very good. There's one or two things missing so I'll upload my example and PM you a link to my behavior with a simple example to show you exactly what I mean. Thanks a lot for your time on this Rex!

  • > Duration behavior

    > (Update: 2012/06/16)

    >

    > The idea of this behavior was came from

    > "Duration behavior" is a timer-like behavior. It will execute callbacks during duration. Like timer behavior, duration need to connect to timeline plugin and function plugin.

    >

    > See sample capx for more detail.

    >

    > <img src="http://i1081.photobucket.com/albums/j352/rexrainbow1/screen1-28.png" border="0">

    > Left side is the setting of duration:

    > Duration time = 1 second : start at 0, end at 1

    > Interval time = 0.3 second : intervals for each 0.3

    >

    > Right side is the execution result:

    > 0 -> execute callback "start"

    > 0.3 -> execute callback "interval"

    > 0.6 -> execute callback "interval"

    > 0.9 -> execute callback "interval"

    > 1 -> execute callback "end"

    >

    > Set callback to "" (empty string) could skip this callback.

    This is very good. There's one or two things missing so I'll upload my example and PM you a link to my behavior with a simple example to show you exactly what I mean. Thanks a lot for your time on this Rex!

    Here is the example to show you my behavior. Left click to move, left click and hold on enemy to attack. Wait till night to get stronger.

  • Update:

    Allow setting interval time larger then duration time. In this case, duration behavior will only trigger "on start" and "on end" callback. It could replace one-shot timer behavior.

  • Update

    • rewrite document.
    • add feature to sync with object's timescale. (User need update timeline plugin first)
  • Would it be possible to change timescale sync at runtime?

    If it's not easy, I can just use a second behavior.

    Already tested.

  • Update

    Add "Action:Sync timescale" to enable or disable timescale synchronization in runtime.

    newt

    Try this new updating.

  • Excellent!

    Makes it a great way to deal with effects, especially if the object is destroyed before the set duration.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)