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! / 2d game, how to, help

Author
Message
Binario
13
Years of Service
User Offline
Joined: 19th Jan 2010
Location: @ front of PC
Posted: 24th Jan 2010 17:15
hi all, i was wondering if there is any way in Dark GDK to , have the frames per second set at 60, and have an animated sprite, move and at the same time play its animation, but the animation not been played at the full 60 fps,

if (dbLeftKey () == 1)
{
if (playerframe > 5
playerframe = 4;
else if ( playerframe > 1 )
playerframe--;
else playerframe = 4;
dbSprite ( 6, playerx,playery, 6 );
playerx = playerx - 1;
}
this code, moves the player to the left and animates it but when set at 60 fps, the animation looks like the legs of the Road Runner in the LooneyToones, im looking for a way to slow that effect down, but am really clueless any help is appreciated
Shadowtroid
13
Years of Service
User Offline
Joined: 23rd Dec 2009
Location: nope
Posted: 25th Jan 2010 15:49
You could set the animation to repeat each frame. Like, do the 1st frame twice, the 2nd twice, etc.

Although, I know almost nothing about coding, so I could sound crazy right about now.

"And we played the first thing that came to our heads...Just so happened to be... the best song in the world...

it was the best song in the world..."
gbark
17
Years of Service
User Offline
Joined: 14th Oct 2005
Location: US - Virginia
Posted: 26th Jan 2010 23:57 Edited at: 26th Jan 2010 23:58
I'd recommend storing playerframe in a float variable instead of an integer, and then when you call the command to set the frame, pass the variable casted as an int.

(I think you'd use something along the lines of dbSetSpriteFrame(1, int(playerframe));, but I don't have DarkGDK so I don't know the exact command name for sure)

Then, instead of changing the frame by 1.0 every game cycle, you could change it by 0.5 to halve the speed, or 0.1 for 1/10th the speed, etc.
Furry
12
Years of Service
User Offline
Joined: 29th Jan 2010
Location:
Posted: 29th Jan 2010 19:35
Hi

You need to add a animation delay in-between frames. This
has to be per set of animation. (Each animation set has its own delay number)

I am not sure if Dark GDK can do that. I am using .NET programming.

See my video on the game I am working on: http://www.youtube.com/watch?v=GjTdjF3Krlk

Determination is like chasing the wind.

Login to post a reply

Server time is: 2023-01-27 02:23:48
Your offset time is: 2023-01-27 02:23:48