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.

Newcomers DBPro Corner / Object looping/frames

Author
Message
Sonic 91 Software
19
Years of Service
User Offline
Joined: 19th Mar 2005
Location: In a Cryptic Crossworld!
Posted: 8th Dec 2007 19:48
I'm sure this is a fairly noob-ish question, hence I'm posting it here rather than the DBP forum. The main character in my game is supposed to loop the movement animation when the up key is pressed. However it is not moving when I press the up key and when I let go it plays the animation once and stops. How can I get it to play only when the up key is being pressed? Here is my code



If I switch the "play object" command for "loop object", the animation plays continuously when I let go of the up key.
Also, the animation "jerks" a bit when it loops, is there a way of getting the number of frames in the object animation, considering it's from Dark Matter?

Fight the good fight of faith,
Lay hold on Eternal Life.
-1 Timothy 6:12-
Gil Galvanti
19
Years of Service
User Offline
Joined: 22nd Dec 2004
Location: Texas, United States
Posted: 8th Dec 2007 20:13
First, I would never use a "then" with multiple statements after an "if", it just gets messy and is unnecessary. Even if there is only one statement, I always use IF...ENDIF . Try this:



wild doogy
16
Years of Service
User Offline
Joined: 3rd Dec 2007
Location: In a Cybersuit.
Posted: 8th Dec 2007 20:29
alternitly you could:



I dont *ahem* know if that will work. it should but i am used to a diffrent language.
vorconan
17
Years of Service
User Offline
Joined: 4th Nov 2006
Location: Wales
Posted: 8th Dec 2007 21:08
I had an issue with this once, maybe this will work:





Sonic 91 Software
19
Years of Service
User Offline
Joined: 19th Mar 2005
Location: In a Cryptic Crossworld!
Posted: 8th Dec 2007 22:42
I added the "loop object" command to just before I used a gosub for the main loop and that seems to have done the trick. However I am still concerned about the jerking as the animation finishes and starts again. Is there any way to find out the frame number of the animation?

Fight the good fight of faith,
Lay hold on Eternal Life.
-1 Timothy 6:12-
vorconan
17
Years of Service
User Offline
Joined: 4th Nov 2006
Location: Wales
Posted: 9th Dec 2007 00:04
Object Frame()



Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 11th Dec 2007 21:35 Edited at: 11th Dec 2007 21:36
When loading, I usually do this:


But as this has probably nothing to do with your question..

When animating an object and keep it simple, I usually use this method:



Obviously, you can vary a bit. For example, this is extracted from a project I coded for testing some things:



set object speed 1, 35
set object interpolation 1, 5
made sure the transistion between idle and walking was smoothly.

It worked pretty good, though the head rotated the wrong way with the interpolation...

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
Sonic 91 Software
19
Years of Service
User Offline
Joined: 19th Mar 2005
Location: In a Cryptic Crossworld!
Posted: 11th Dec 2007 23:26
Hi, Sven B. Is it just me or have you not been around for a while?

Anyway, the "loop object" command I fixed a few days ago, I came across the solution for the jerky animation of the objects in the Darkmatter readme file of all places. It gave example code on how to load/animate an object and it said start on frame 5. I tried that and it worked. However I will keep all your ideas in mind for future reference.

Fight the good fight of faith,
Lay hold on Eternal Life.
-1 Timothy 6:12-
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 12th Dec 2007 10:35
I have been around the whole time. But I switched to DBP instead of DBC .

The last example code I gave allows you to stop the current animation in the middle and create a smooth interpolation to your walking or idle animation. I tried to bypass the "jump" effect where you just pop to a new position when changing animation.

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.

Login to post a reply

Server time is: 2024-09-27 08:31:15
Your offset time is: 2024-09-27 08:31:15