[Make it easier] Time in the game

For questions about using Classic.

Post » Thu Jan 07, 2010 5:18 pm

Continuing the theme of how to make things easier.

The second task:

:!: If we pressed ''Space'' a new sprite appears on the screen after one second, then it moves up (after 1sec), then to the right and then it's destroyed (after one second too). If we press Space again, the loop is repeated.

I know three ways of how to create time countdown in the game that lets you manipulate objects.

:arrow: Method 1 (Variable)



Time is created using Global variable.


:arrow: Method 2 (Function)



Time is created using the Function object.


:arrow: Method 3. (Animation)




There is a sprite in the scene named Controller with animation, and time counts due to this animation (1 frame per second).


All 3 methods are absolutely working. By default, the sprite has enabled Destroy on startup attribute, therefore it's destroyed after run the application.

:?: If you know more simple and correct methods of creation time in the game, please write them in this topic.
B
3
S
2
G
3
Posts: 146
Reputation: 1,567

Post » Thu Jan 07, 2010 5:52 pm

Well there's the timeline object.
Ill see if I cant make a cap that demonstrates.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Thu Jan 07, 2010 6:25 pm

[quote="newt":1tp3etnp]Well there's the timeline object.
Ill see if I cant make a cap that demonstrates.[/quote:1tp3etnp]

Oops! I didn't know about it... :shock: Is it a new object?

I've tried to use it, but don't understand how to work with it...
If you know could you make an example?
B
3
S
2
G
3
Posts: 146
Reputation: 1,567

Post » Thu Jan 07, 2010 6:29 pm

Here ya go

[url:2mzg48b4]http://dl.dropbox.com/u/666516/timelineasy.cap[/url:2mzg48b4]

Guess the hardest part to figure out is how to edit it on the object side of the editor.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Thu Jan 07, 2010 6:49 pm



Is this easier? It certainly takes fewer events and you don't need a function or timeline object.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Thu Jan 07, 2010 7:45 pm

[quote="deadeye":51nll7h3]

Is this easier? It certainly takes fewer events and you don't need a function or timeline object.[/quote:51nll7h3]

That actually would not work unless you pressed the button right at the start of the layout. you would have to reset time to 0 in the on space pressed event to make it work. but other than that it seems like the bets solution.....
B
5
S
2
G
4
Posts: 632
Reputation: 2,829

Post » Thu Jan 07, 2010 7:49 pm

newt
Thank you for the example. It helped me to understand Timeline object and I can already use it in my games. I've changed it a little:





deadeye
Great solution to create time in the application using Timedelta. The only thing I changed the private variable to global, because PV works only if the object already exists in the scene. But it must appear only after one second.




Thank you all!

If someone knows other ways of how to control time write here!
B
3
S
2
G
3
Posts: 146
Reputation: 1,567

Post » Thu Jan 07, 2010 7:56 pm

[quote:36givdgd]But it must appear only after one second.[/quote:36givdgd]

Oh hehe, guess I missed that part. Anyway, carry on.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Thu Jan 07, 2010 8:36 pm

[quote="Aeal5566":vcdjyhc0]

That actually would not work unless you pressed the button right at the start of the layout. you would have to reset time to 0 in the on space pressed event to make it work. but other than that it seems like the bets solution.....[/quote:vcdjyhc0]

heh Mary jane already fixed that.
Just set the variable when you press space.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 6 guests