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.

Dark GDK / Help with movement animations

Author
Message
Orin
16
Years of Service
User Offline
Joined: 16th Feb 2008
Location:
Posted: 18th Feb 2008 09:16
I Have decided to put off my space sim till i get better at dgdk,

i have decided a better bit of practace would be to make a 3d side scroller, it is very minimal in code right now as im trying to nail down the movement animations and what not,

so far all i have is a walk anim. the problem is useing the dbLoopObject doesnt stop looping after the button is depressed and released, i have tryed a few things like setting up if else statements but im not sure exactly how to impliment it, im useing a stock dgdk model for the player char as i dont have to put hr's in to building the models from scratch then animateing them.

here is my code, as i said its very minimal and simplistic as all the things in the samples and what not really are no help here.



if anyone knows what im doing wrong and can help me figure it out i would really appreciate it, right now all i need is some one to help me get my model to use the walk loop when the rightarrokey is pressed and to go into an idle anim when it isnt, thanks in advance. orin

ill get there sooner or later, just you watch.
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 19th Feb 2008 06:31
Orin - First - I think this is important. Change your code to move not on arbitrary "values" that "look right" on your PC. Instead - learn how to user timer based movement. This way your game will run approximately the same "Speed" on various PC's.

Second - Animations work the same way with 3d Objects - in that you can drop the whole "loop" business - and Set the animation "Position" each loop - again based on timer logic. (Sounds harder than it is. Increment Animation frame by "Animation Increment Per Thousandth of a Sec * TimeElapsed".

Loop Object is very Rigid and is based on the Sync rate - and this may work - it is not a good practice to get into and rely on.

Note also - animations "frames" with 3d objects are actually floats - so you can have an animation frame be at 1.5 for example.

You may find smoother animation for example if your start frame is 2.34 and the end frame is 10.36. (Just made up values to get the point across)

Also - the whole idle - walking thing? A simple flag named something like IDLE: bool Idle; Should do ya. Set it to TRUE before you poll the user's keypresses. If any "Walking" keys are pressed - set this flag to FALSE (NOT IDLE)... Then change the object animation accordingly.

Hope this sparks some ideas. there are some good posts, threads, newletter articles and CODE BASE entries that discuss Timer Based Movement and Timer Based Animations.

To Summerize - dbTimer() is a function that returns Milliseconds since Midnight I think. The Whole FOUNDATION for TimerBased movement and animations is here:

jgc_clock.h


jgc_clock.cpp


Basically - this code has what ya need - but if you wish to use this class... At the top of your program make sure to


then before your main loop - set up an instance of this class:


then in your main loop just call the update function at the top of your loop like this:


Now you can ALWAYS do timer based logic based on this value:



Good Luck - hope this helps you out a bit.

Orin
16
Years of Service
User Offline
Joined: 16th Feb 2008
Location:
Posted: 19th Feb 2008 07:06
Wow thats alot more then I expected, Thank you. not sure I understand it all and how to use it but that's why im tinkering with it. so I can learn this stuff. anyway. Thank you very much and it may not help alot now but after i figure out how to use it and how it works im very sure that it will help me out alot.

ill get there sooner or later, just you watch.

Login to post a reply

Server time is: 2024-11-17 06:24:04
Your offset time is: 2024-11-17 06:24:04