You guys may recognize this program from my "simple 2D gravity" thread....well i have another bug.
The gravity system runs fine and now im starting on a function handling the input for movement and eventually aiming and shooting. but for some reason the function is never entered in the program. heres my code:
// 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"
class Player {
public:
int X,Y; //Coordinates for top-left corner of player
int JumpSpeed;
int Collision[4]; //Collision flags for 4 points on player:
//0=Top, 1=Right, 2=Bottom, 3=Left
Player();
void UpdateColData();
};
//
//Player class constructor
//
Player::Player() {
JumpSpeed=0;
return;
}
void Player::UpdateColData() {
//Set the BMP to the collision BMP
dbSetCurrentBitmap(1);
//Check for top Collision
if(dbPoint(X+24,Y-3)==dbRGB(255,255,255))
Collision[0]=1;
else
Collision[0]=0;
//Check for right Collision
if(dbPoint(X+51,Y+40)==dbRGB(255,255,255))
Collision[1]=1;
else
Collision[1]=0;
//Check for botton Collision
if(dbPoint(X+24,Y+83)==dbRGB(255,255,255))
Collision[2]=1;
else
Collision[2]=0;
//Check for left Collision
if(dbPoint(X-3,Y+40)==dbRGB(255,255,255))
Collision[3]=1;
else
Collision[3]=0;
dbSetCurrentBitmap(0);
return;
}
void Input();
void DarkGDK ( void )
{
// turn on sync rate and set maximum rate to 60 fps
dbSyncOn ( );
dbSyncRate ( 60 );
dbRandomize(dbTimer());
dbSetDisplayMode(640,480,32);
//Create the Player
Player Player1;
//Create a Hidden BMP for collision detection
dbCreateBitmap(1,640,480);
//Draw a hidden "Floor" on the collision BMP
dbSetCurrentBitmap(1);
dbInk(dbRGB(255,255,255),0);
dbBox(0,400,639,479);
//Make a Player Image and set a constant variable to that image
dbGetImage(1,0,400,48,479);
const int i_Player=1;
//set current BMP to screen
dbSetCurrentBitmap(0);
Player1.X=1; Player1.Y=1;
// our main loop
while ( LoopGDK ( ) )
{
//paste player image to screen
dbPasteImage(i_Player,Player1.X,Player1.Y);
// update the screen
dbSync ( );
Player1.UpdateColData();
//Handle Gravity
if(Player1.Collision[2]==0) {
if(Player1.JumpSpeed>(-5)) {
Player1.JumpSpeed--;
}
}
else {
Player1.JumpSpeed=0;
Input();
}
//Move Player according to Jump Speed
if(Player1.JumpSpeed!=0) {
Player1.Y-=Player1.JumpSpeed;
}
dbCLS(0);
}
// return back to windows
return;
}
void Input() {
//Jumping
if(dbUpkey()==1) {
if(Player1.collision[0]==0)
Player1.jumpspeed=5;
}
return;
}
any ideas? also when i try and use breakpoints they become hollwed out and when i mouse over them i get a caption about the source code being different from the original......whats that about?