I now realize there should have been an int before player::gravity, but even so my program still crashes when i try to run it
my main.cpp is as follows
#include "DarkGDK.h"
#include "player.h"
void DarkGDK ( void )
{
// turn on sync rate and set maximum rate to 60 fps
dbSyncOn ( );
dbSyncRate ( 60 );
dbLoadImage("player.bmp",1);
dbLoadImage("platform.bmp",2);
dbSprite(1,0,0,1);
dbSprite(2,320, 440,2);
player player;
// our main loop
while ( LoopGDK ( ) )
{
dbSync ( );
// update the screen
player.fall();
}
// return back to windows
return;
}
heres player.cpp
#include "DarkGDK.h"
#include "player.h"
#define plr 1
#define platform 2
player::player()
{
}
player::~player()
{
}
int player::fall()
{
for(int vel = 0; dbSpriteCollision(plr, platform) == 0; vel += -3)
{
dbMoveSprite(plr, vel);
}
return(0);
}
and heres player.h
class player
{
public:
player();
~player();
int fall();
private:
};
this program compiles but simply runs as a black screen that causes the program to crash. can anybody please offer me some advice?
"I'm sick and tired of following my dreams, I'm just gonna ask them where they're headed and meet up with 'em later"
-Mitch Hedberg