0 registered members (),
1,397
guests, and 7
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Animation FPS speed
#125926
04/24/07 01:18
04/24/07 01:18
|
Joined: Jul 2006
Posts: 91 Florida, USA
Knuckles
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2006
Posts: 91
Florida, USA
|
How do I go about changing the animation speed of an entity? I've looked all in my animate() functions and I can't figure out why the animation is so fast. The animation goes so fast it literally looks like a blur on the screen. Whether running it fullscreen or windowed, it still does the same thing. this is what the walk animation looks like: Code:
var wait_start=0; var wait_end=1; var player_walk_frames[2]= 22,42;
function animate_walk() { while(1) { if((player.frame > player_walk_frames[wait_end]) || (player.frame < player_walk_frames[wait_start])) { player.frame = player_walk_frames[wait_start]; } player.frame += 0.7 * time; wait(1); } }
I've tried adjusting the animation time and player speed, but nothing seems to work. Here's a screenshot of some extra F11 info on the screen when I run the program in case this helps:
|
|
|
Re: Animation FPS speed
[Re: MrCode]
#125928
04/24/07 03:06
04/24/07 03:06
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
Code:
while(1) { temp.x = 0.7 * time_step; // speed temp.y = player_walk_frames[wait_start]; // min temp.z = player_walk_frames[wait_end]; // max player.frame = cycle(player.frame + temp.x, temp.y, temp.z); wait(1); }
Also try lowering the 0.7 considerably. I think it's way too high. Also, another (much easier) way of animating is to use the ent_animate() function...
xXxGuitar511 - Programmer
|
|
|
Re: Animation FPS speed
[Re: MrCode]
#125929
04/24/07 04:01
04/24/07 04:01
|
Joined: Jul 2006
Posts: 91 Florida, USA
Knuckles
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2006
Posts: 91
Florida, USA
|
Quote:
Are you using vertex or bones animation?
>_> how do I find that out?
guitar: I'll try it and see, thanks!
|
|
|
Re: Animation FPS speed
[Re: Doug]
#125932
04/24/07 20:05
04/24/07 20:05
|
Joined: Jul 2006
Posts: 91 Florida, USA
Knuckles
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2006
Posts: 91
Florida, USA
|
I don't understand how the animate_walk function is an endless loop since it has a wait(1) at the end? Usually if I leave out the wait(1) I get a message saying that it's an endless loop.
Do I need to add a return function after the wait(1)?
Last edited by Knuckles; 04/24/07 20:06.
|
|
|
Re: Animation FPS speed
[Re: Scorpion]
#125934
04/24/07 23:33
04/24/07 23:33
|
Joined: Mar 2007
Posts: 677 0x00000USA
MrCode
User
|
User
Joined: Mar 2007
Posts: 677
0x00000USA
|
RE: Vertex/Bones animation If you animated your model by clicking and dragging the verticies for every frame, then you are using vertex animation. If you are creating a virtual "skeleton" made out of "bones" and moving them for every frame, then you are using bones animation. (this type of animation can also be blended with code). EDIT: If you're using vertex animation, this is a much easier way to do it: Code:
var walk_speed; var breath_speed; var jump_speed;
...
action char_walk { my.fat= on; my.narrow= on; c_setminmax(my); while(1) { if(key_cuu== on) { c_move(my,vector(0,6 * time_step,0),nullvector,glide); ent_animate(my,"walk",walk_speed,anm_cycle); walk_speed+= 10 * time_step; } else { ent_animate(my,"stand",breath_speed,anm_cycle); breath_speed+= 3 * time_step; } if(key_cud== on) { c_move(my,vector(0,-6 * time_step,0),nullvector,glide); ent_animate(my,"walk",walk_speed,anm_cycle); walk_speed+= 10 * time_step; } if(key_cul== on) { my.pan+= 10 * time_step; } if(key_cur== on) { my.pan-= 10 * time_step; } if(key_j== on) { c_move(my,vector(0,0,15 * time_step),nullvector,glide); ent_animate(my,"jump",jump_speed,anm_cycle); jump_speed+= 14 * time_step; } else { c_move(my,vector(0,0,-15 * time_step),nullvector,glide); }
Mabye it's not any shorter than your current code, but this would allow your char to move and turn w/ the arrow buttons, and jump with the J key.
Last edited by MrCode; 04/24/07 23:39.
|
|
|
Re: Animation FPS speed
[Re: MrCode]
#125935
04/25/07 00:10
04/25/07 00:10
|
Joined: Mar 2007
Posts: 776 Poor village - Poland ;)
tompo
User
|
User
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
|
But better one is bone animations of'course. Maybe is a little slower but a lot of easyer to create. 1. create bones 2. Attach vertex to bones 3. make some simple animation and name it f.e. test 4. then in player loop add f.e. make_animation(); 5. create function with the same name (make_animate) Code:
action player { .... ..... make_animate(); }
then make_animate function Code:
define anim_speed, skill1; function make_animate { my.anim_speed += 3 * time_step; // how fast animation should be ent_animate(me,NULL,0,0); // reset bones every loop ent_animate(me,"test",my.anim_speed,anm_cycle); //animate } After all the best way to learn is practice and reading help Check f.e this click and go and find animation part.
Never say never.
|
|
|
|