Here is what I have so far:
#include "DarkGDK.h"
void CheckMovement(float fXPos);
void CheckShoot(float fXPos);
void DarkGDK() {
dbSyncOn( );
dbMakeObjectCube(1, 10.0);
dbMakeObjectCube(2, 0.5);
dbHideObject(2);
float fXPos = dbObjectPositionX(1);
dbPositionObject(1, fXPos, -75.0, 150.0);
while (!dbEscapeKey()) {
fXPos = dbObjectPositionX(1);
CheckMovement(fXPos);
CheckShoot(fXPos);
dbSync();
}
}
void CheckMovement(float fXPos) {
if (dbLeftKey() && fXPos >= -100.0) {
dbMoveObjectLeft(1, 2.0);
}
if (dbRightKey() && fXPos <= 100.0) {
dbMoveObjectRight(1, 2.0);
}
}
void CheckShoot(float fXPos) {
if (dbSpaceKey()) {
float fYPos;
dbPositionObject(2, fXPos, -75.0, 150.0);
dbShowObject(2);
while (fYPos <= 400.0) {
fYPos = dbObjectPositionY(2);
dbMoveObjectUp(2, 1.0);
}
}
}
The problem is, nothing shoots out at all, the window just closes (I assume a crash).
- Scarface