Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / animation speed

Author
Message
LordoFire
21
Years of Service
User Offline
Joined: 14th Feb 2004
Location: United States
Posted: 13th Mar 2004 07:11
How do you set how fast an animation goes? Thanks.

When it comes to programing, I'm on fire!
old rinkly
21
Years of Service
User Offline
Joined: 11th Mar 2004
Location: Devon UK
Posted: 13th Mar 2004 18:24
I just use the " Sync rate Whatever" and vary it until you get the right speed.
see code.
In some cases, I put in a "wait" command and vary the time.
Happy Programing

old wrinkly
LordoFire
21
Years of Service
User Offline
Joined: 14th Feb 2004
Location: United States
Posted: 14th Mar 2004 05:32
thanks alot wrinkly!

When it comes to programing, I'm on fire!
Code Stealer
21
Years of Service
User Offline
Joined: 12th Feb 2004
Location:
Posted: 15th Mar 2004 13:58
ANother way to do it is to use an array or data line to hold the sequence of animation frames. Then if you want it slower, just repeat the numbers, so it plays the same frame twice. This is a very powerfull way to do it, as it lets you have different anims playing differently paced actions. Like for a still breathe cycle, you might have four frames and want it to loop every second, so you have this:

1111222233334444

but then when your hero swings his sword you have 3 frames that play really quick, but then he holds on the last frame for a while:

567777777

see what I mean? If you start putting wait commands or messing with the sync rate you will effect the whole program, where as if you have lists of frames that you play you can controll the speed manually for each anim without effecting the speed of the whole game!

GIve me more power!
Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 15th Mar 2004 15:01 Edited at: 15th Mar 2004 15:03
Well really none of these ideas are quite right. They are all going to mess something up. They will either stop the program from running for awhile, or they will be too fast on faster computers, and too slow on slower computers. Avi's have a built in speed control I think, so they should be OK. You should use the Timer() to control your animation speed, but not Wait because that will stop everything.

Do this....

Sync On
Speed = Whatever you want...Something around 300-500

T=Timer()+ Speed


Do

Gosub Animate
sync
Loop

Animate:
Put your animations in here, all having their own Timer() command.

If T<= Timer()

Here..Do an animation frame, or read an array like Code Stealer said.

T = Timer() + Speed
Endif

Return

Login to post a reply

Server time is: 2025-06-30 12:51:17
Your offset time is: 2025-06-30 12:51:17