That is weird...
Here's some thing I was playing around with a week or two ago:
#include "DarkGDK.h"
#include "scancodes.h"
void showFrameNum(int framenum)
{
char czText[256];
wsprintf(czText, "Frame Number: %d", framenum);
dbText(0, 15, czText);
wsprintf(czText, "Frame Rate: %d", dbScreenFPS());
dbText(0, 30, czText);
}
void DarkGDK ( void )
{
float movementspeed=0.0f;
float rotatespeed=5.0f;
float acceleration=0.025f;
float maxspeed=2.5f;
int framenum=0;
int topX=0;
int topY=0;
bool playing=true;
dbSyncOn ( );
dbSyncRate ( 60 );
dbSetWindowOff();
dbSetWindowTitle("Void Galaxy");
//Load images
dbSetImageColorKey(255, 0, 255); // bright pink is transparent.
dbSetDir("media\");
//Ship images
dbLoadImage("media\Starships\beginnership.png", 1); // beginner's ship
dbLoadImage("media\Planets\planet1.bmp", 1001);
dbLoadImage("media\starsbackground.png", 5001);
//End of ship images
//End of images
//player's ship sprite
dbSprite(1, dbScreenWidth()/2, dbScreenHeight()/2, 1);
dbOffsetSprite(1, dbSpriteWidth(1)/2, dbSpriteHeight(1)/2);
dbScaleSprite(1, 45);
dbSetSpritePriority(1, 1);
dbSprite(2, dbScreenWidth()/2, dbScreenHeight()/2, 1001);
dbOffsetSprite(2, dbSpriteWidth(2)/2, dbSpriteHeight(2)/2);
dbSetSpritePriority(2, 0);
dbHideMouse();
//star background
while ( LoopGDK ( ) )
{
framenum++;
if (dbKeyState(Key_A)) // left turn
dbRotateSprite(1, dbSpriteAngle(1) - rotatespeed);
if (dbKeyState(Key_D)) // right turn
dbRotateSprite(1, dbSpriteAngle(1) + rotatespeed);
if (dbKeyState(Key_W)) // increase speed
if (movementspeed < maxspeed)
movementspeed+=acceleration;
if (dbKeyState(Key_S)) // decrease speed
if (movementspeed > acceleration/2)
movementspeed-=acceleration;
if (dbKeyState(Key_R))
if (dbSpriteX(1) - dbSpriteX(2) < dbSpriteWidth(2) && dbSpriteY(1) - dbSpriteY(2) < dbSpriteHeight(2))
if (dbSpriteImage(1) == 1)
dbSetSpriteImage(1, 2);
else if (dbSpriteImage(1) == 2)
dbSetSpriteImage(1, 3);
else if (dbSpriteImage(1) == 3)
dbSetSpriteImage(1, 1);;
//move the player//
dbMoveSprite(1, movementspeed);
dbPositionCamera(dbSpriteX(1), dbSpriteY(1), 0);
///////////////////
dbRotateSprite(2, 0.1f);
showFrameNum(framenum);
dbSync ( );
}
dbShowMouse();
return;
}
Please ignore my newbiness. It was my first project with DarkGDK.
If you can do any models for FW, reply to the FleetWars thread.
Click here!