I seem to have a big problem with the dbAutoCam, i turned it off in my code but it still seems to not want to work.
BTW my code is realy messy and probly not done right but please dont comment about it.
Code:
// Dark GDK - The Game Creators - www.thegamecreators.com
// the wizard has created a very simple 3D project that uses Dark GDK
// it can be used as a starting point in making your own 3D games
// whenever using Dark GDK you must ensure you include the header file
#include "DarkGDK.h"
#include "Enemys.h"
int jumps = 0;
// the main entry point for the application is this function
void DarkGDK ( void )
{
// in this application we are going to create some 3D objects
// and position them on screen
dbMaximizeWindow();
dbBackdropColor(dbRgb(0,0,180));
// in this application we are going to create some 3D objects
// and position them on screen
float fObjectAngleY = 0.0f;
// when starting a Dark GDK program it is useful to set global
// application properties, we begin by turning the sync rate on,
// this means we control when the screen is updated, we also set
// the maximum rate to 60 which means the maximum frame rate will
// be set at 60 frames per second
dbSyncOn ( );
dbSyncRate ( 60 );
dbAutoCamOff ();
// set our random seed to a value from the timer, this will help
// to ensure each time we run our program the random values appear
// more random
dbRandomize ( dbTimer ( ) );
dbMakeObjectCube(1,1);
dbScaleObject(1,200,200,200);
dbPositionObject(1,0,5,0);
dbMakeObjectCube (2,1);
dbScaleObject (2,5000,5000,100);
dbPositionObject (2,0,0,0);
dbColorObject (2,dbRgb (0,200,0) );
dbSetObjectSpecularPower (2,255);
dbSetObjectAmbient (2,0);
dbRotateObject (2,-90,0,0);
dbMakeObjectCube (3,1);
dbScaleObject(3,200,200,200);
dbPositionObject(3,5,5,0);
dbMakeObjectCube (4,1);
dbColorObject(4,dbRgb(0,180,0));
dbPositionObject(4,dbObjectPositionX (3),dbObjectPositionY (3)+2,dbObjectPositionZ (3));
dbSetObjectSpecularPower (4,255);
dbSetObjectAmbient (4,0);
dbMakeLight(1);
dbPositionLight(1,0,10,0);
dbHideMouse ();
// now we come to our main loop, we call LoopGDK so some internal
// work can be carried out by the GDK
while ( LoopGDK ( ) )
{
dbText(0,0,dbStr(enemyhealth));
if(dbUpKey ())
{
dbMoveObject (1,0.1);
}
if(dbDownKey ())
{
dbMoveObject (1,-0.1);
}
if(dbSpaceKey ())
{
if(jumps <= 10)
{
dbMoveObjectUp (1,0.2);
jumps++;
}
}
if(dbMouseClick() == 1)
{
if(dbObjectCollision(1,3) == 1)
{
dbText(380,400,"HIT!");
enemyhealth-=0.1;
}
}
// create a rotation axis based on mouse movement
fObjectAngleY = dbWrapValue ( fObjectAngleY + dbMouseMoveX ( ) * 0.2f );
// rotate camera
dbYRotateObject (1, fObjectAngleY );
dbPositionMouse (320,240);
dbSetCameraToFollow(dbObjectPositionX(1),dbObjectPositionY(1),dbObjectPositionZ(1), dbObjectAngleY (1) , 15,6,6 ,0);
if(dbObjectCollision(1,2)==0)
{
dbMoveObjectDown(1,0.1);
}
if(dbObjectCollision(3,2)==0)
{
dbMoveObjectDown(3,0.1);
}
if(dbObjectCollision(1,2)==1)
{
jumps = 0;
}
EnemyHealthScale();
CheckEnemyHealth();
// here we make a call to update the contents of the screen
dbSync ( );
}
// and now everything is ready to return back to Windows
return;
}