Timer behaviour

New releases and general discussions.

Post » Tue Feb 17, 2009 6:05 pm

Quite a few times I've run into a situation where I wished for a simple and manageable timer for objects. I've been using Fade behaviour to that effect, a PV and a few events to behave as the timer etc...

So here is the feature request:
Timer Behaviour
- start timer on create (option)
- destroy after time (option)
- get current time
- repeat (for example it would go from 0 to 1000 and then repeat)
- on timer expired > action
- start timer
- set timer

And so on. Having a dedicated timer behaviour would really be convenient for the game development! :)
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Tue Feb 17, 2009 10:53 pm

you can just use private variables for all this.
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Tue Feb 17, 2009 11:42 pm

I think a timer would be handy :)
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Wed Feb 18, 2009 12:49 am

It's an easy and nice behavior for someone new to the SDK to make.

Someone make it, gogogo.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Wed Feb 18, 2009 1:15 am

Ill get on it as soon as a finish my current plugin project. Would it be an object or a behavior?
B
5
S
2
G
4
Posts: 632
Reputation: 2,829

Post » Wed Feb 18, 2009 1:43 am

Sounds like an object to me.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Wed Feb 18, 2009 12:55 pm

The original post sounds like he wanted a behavior, so individual objects could hold a unique timer.

Tip for SDK developers: use GetLayoutClock() as the timer function (milliseconds since start of layout) since it's high-resolution and timescaling compatible.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,468

Post » Wed Feb 18, 2009 1:02 pm

When we discussed it on the chat, we thought it'd be best as a behavior; that way if you have a collision event involving only one instance, you can have a 'start timer: destroy, for 1000ms' and then when it goes off, only that object is destroyed.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Sat Feb 21, 2009 6:05 pm

This kind of behaviour sounds like it would be rather simple, and could be a good tutorial for writing behaviours :) Whoever makes it, please make it open source so others can learn :D
B
4
S
2
G
5
Posts: 641
Reputation: 3,011

Post » Wed Feb 25, 2009 2:59 pm

I've created this for the next build, the source should be on CVS very shortly for anyone interested.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Next

Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 2 guests