Pls add script interface for Timer Behavior

0 favourites
  • 5 posts
From the Asset Store
Customize the animation of character when item changed
  • Many interfaces were added in the previous beta-cycle (r306), but Timer was not one of them. Just wanted to put it out there, I hope we can get it this beta-cycle. I'd need it :)

  • I thought about it but it seems trivial to implement in JS, either by the built-in timers (e.g. setTimeout) or by adding dt to a counter every tick, which is basically what the Timer behavior does. Using a script interface is arguably more complicated than just coding it yourself, so I decided against implementing it at first. Can you explain what you need it for? Are you trying to integrate with timers set by events or were you thinking it would save on coding?

  • The main assumption was just that it's missing and thus will eventually be added.

    In my case I will need quite a lot of different per-instance timers, so using setTimeout I'd also need to associate those with each instance and whatnot. I'm not even sure how I would do that technically tbh other than storing everything in an object with arrays. (I'm a bit of a js scrub)

    I'm not fully coding in JS (and I don't plan to) so it's more than likely that eventually I'll have to mix timers in events and JS. The main reason why I use JS is that it's just so vastly superior/quicker/easier to work with for heavy data-driven stuff.

    Either way I can also just shove that part back into the eventsheet by calling a function where I set the timer, though that wouldn't be nearly as clean. I remembered I could also abuse the Tween behavior as a timer since it has a scripting interface (and even further benefits like "Is ANY playing") though I don't know if there's any performance implications for value tweens vs timer behavior.

  • Thank you for adding it, works like a charm! :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yea really appreciate the Timer behavior. Could we get docs for `ITimerBehaviorInstance` ?

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