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 / Animations

Author
Message
Red Eye
16
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 29th Jun 2010 01:47 Edited at: 29th Jun 2010 01:48
Hey,

I am having troubles with animations.
I now know that u cant call dbPlayObject, in a loop.
So i thought this:



I also tried with current frame being bigger or smaller then needed animations.

But all this will be a mess/ or not work when working with multiple anims, idle/run/walk/crouchidle/crouchwalk... and so on...

Ideas?

I was thinking about buying enhanced animations.

But i rather do it free.

I hope u can help me out.

Greets,

Red Eye

JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 29th Jun 2010 03:12
Not sure what the problem is that you're having but I'll see if I can run down the options for you:

1) dbPlayObject() - Plays the animation from start to end one-time then stops.

2) dbLoopObject() - Plays the animation from start to end then loops back around and does it again until you tell it to stop (dbStopObject)

3) dbSetObjectFrame() - Shows the specified animation frame to the screen. This is useful for roll-your-own animation sequences (step through the animation manually through code)

NOTE: dbStopObject() will stop the animation whether it was started via dbPlayObject or dbLoopObject.

You can check if the animation is playing with dbObjectPlaying() and dbObjectLooping(). If either of these return a non-zero value, then the animation is playing/looping accordingly

Other items of note are:

1) dbTotalObjectFrames() returns the total number of animatin frames for the object. Note: It does not distinguish between walk/run/crouch etc... If the object holds all these animations, then they all get added to the return value.

2) dbSetObjectInterpoation() specifies how quickly you want to *blend* two animations together. That is, when walking animation is looping and you want to change to Run, this function will determine how quickly the animations change to reflect the new Run animation.

3) dbSetObjectSpeed() allows you to specify how quickly you want to move from one frame to the next in the animation sequence.

There are others, I'm sure, but these are the ones that I tend to utilize the most...

Hope this helps,

JTK
_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 29th Jun 2010 03:17 Edited at: 29th Jun 2010 03:22
I'm not quite sure if this is what you want, but it should properly animate your model without Enhanced Animations.
Basically this is the way I do animations, so there may be better ways.

First of all I have a variable (of a global scope if you want to) that holds the current animation frame you want your model to have plus a variable for the desired start and stop frames:



You should also declare a variable that stores how fast your animation will play (in an advanced program this value should depend on the elapsed time between each loop!):



Then in the main loop I set the object to be at that frame:



Now you just have to increase (or decrease for reverse animations) in the main loop and handle the animation loop:



Remember that this is just a quick concept that I wrote from how I recall it right now, but that's about the way I do it mostly. I think you get the idea of it. Good luck.

EDIT:

@JTK: I was typing while you already responded. Of course you're right with what you wrote. There are many ways to handle animations.

Now the plot thickens, the fps decreases, and the awesomeness goes through the roof.
Red Eye
16
Years of Service
User Offline
Joined: 15th Oct 2008
Location:
Posted: 29th Jun 2010 09:15 Edited at: 29th Jun 2010 09:25
Really thanks, mates. I apreciate your help.

@JTK: Thanks for the elaboration.

@Pauli: Good one. Thanks.

I fixed my problem tho.

Here:
dbPlayObject(playerObj,235.0f,260.0f);

I dunno why it works with floats and not int, it apears that with floats the anim doesnt start over, when command is placed in loop.

Altough i am gonna try your trick Pauli.

Login to post a reply

Server time is: 2024-11-19 20:37:23
Your offset time is: 2024-11-19 20:37:23