OK i am planning on making a remakes of Heli Attack 2 (off Miniclip as well as other sites). I am an experiences DBC Programmer and have a lil knowledge of C++.
Anyway when this is run it should create the "player" (currently just a filler image and basic physics data) in the top-left corner and let it fall until it hits an invisible floor (the floor is on bitmap 1), but its not working and i cant figure out why.
also whenever i put breakpoints in they say something about not working because the source code changed or something......idk)
any ideas? feel free to ask questions
// 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() {
return;
}
//Player class function for updating the players' collision flags
void Player::UpdateColData() {
//Set the BMP to the collision BMP
dbSetCurrentBitmap(1);
//Check for top Collision
if(dbPoint(X+24,Y-3)==RGB(255,255,255))
Collision[0]=1;
else
Collision[0]=0;
//Check for right Collision
if(dbPoint(X+51,Y+40)==RGB(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)==RGB(255,255,255))
Collision[3]=1;
else
Collision[3]=0;
dbSetCurrentBitmap(0);
return;
}
// 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 );
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;
//Move Player according to Jump Speed
if(Player1.JumpSpeed!=0) {
Player1.Y-=Player1.JumpSpeed;
}
System("CLS");
}
// return back to windows
return;
}