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.
// Dark GDK - The Game Creators - www.thegamecreators.com
// the wizard has created a very simple project that uses Dark GDK
// it contains the basic code for a GDK application
// whenever using Dark GDK you must ensure you include the header file
#include "DarkGDK.h"
void showFPS ();
char czFPS[10];
char czText[256];
bool IsWalking;
int IsIdle;
// the main entry point for the application is this function
void DarkGDK ( void )
{
// turn on sync rate and set maximum rate to 60 fps
dbSyncOn ( );
dbSyncRate ( 60 );
dbPrint("Loading Please Standby");
dbSync();
dbSync();
//load our models.
dbLoadObject("Colonel-X\\Colonel-X.X", 1);
dbYRotateObject(1,-90);
dbScaleObject(1,30,30,30);
dbPositionCamera( 0, 50, -80);
bool IsWalking;
// our main loop
while ( LoopGDK ( ) )
{
if (IsWalking == true)
{
dbLoopObject(1, 235, 259);
}
else
{
IsWalking = false;
}
if ( dbRightKey() || dbKeyState(32) == 1)
{
dbMoveObject(1, -0.1f);
IsWalking= true;
dbRotateObject(1,0.0f,-90.f,0.0f);
dbSetObjectSpeed (1, 30);
}
if ( dbLeftKey() || dbKeyState(31) == 1)
{
dbMoveObject(1, -0.1f);
dbLoopObject(1, 235, 259);
dbSetObjectSpeed(1, 30);
dbRotateObject(1,0.0f,90.0f,0.0f);
}
// update the screen
dbSync ( );
}
// return back to windows
return;
}
void showFPS()
{
//Int iLoop;
char czText[256];
wsprintf (czFPS , "%d FPS " , dbScreenFPS ( ) );
dbText ( 0 , 0 , czFPS );
//wsprintf ( czText , "%d HEALTH " , health );
//dbText ( 0 , 15 , czText );
/*for ( iLoop = 0 ; iLoop < visCount ; iLoop++ )
{
sprintf ( czText , "Vis %d , Start = %d, End = %d, Start Obj = %d, End Obj = %d" , iLoop , vis[iLoop].start , vis[iLoop].end , vis[iLoop].startObj , vis[iLoop].endObj );
dbText ( 0 , ( iLoop + 1 ) * 15 , czText );
}
sprintf ( czText , "Current Vis = %d" , currentVis );
dbText ( 0 , 600-20 , czText );*/
}
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.