// 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"
#include "SC_Collision.h"
// 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 );
dbLoadImage ( "map.jpg", 1 );
dbLoadImage ( "map.jpg", 2 );
dbSetCameraRange ( 1.0f, 3000000.0f );
SC_Start ( );
dbSetupTerrain ( );
dbMakeObjectTerrain ( 1 );
dbSetTerrainHeightMap ( 1, "map.jpg" );
dbSetTerrainScale ( 1, 2.0f, 0.6f, 2.0f );
dbSetTerrainTexture ( 1, 1, 2 );
dbSetTerrainLight ( 1, 1.0f, -0.25f, 0.0f, 1.0f, 1.0f, 0.78f, 0.5f );
dbBuildTerrain ( 1 );
dbPositionCamera ( 385, 23, 100 );
dbMakeLight ( 6 );
dbSetLightRange ( 6, 10 );
dbMakeObjectSphere ( 4, 10 );
SC_SetObjectCollisionOn ( 4 );
SC_SetObjectCollisionOn ( 1 );
dbPositionCamera (500, 11, 452 );
dbMakeCamera ( 3 );
dbSetCameraView ( 3, 0, 0, 100, 100 );
// our main loop
while ( LoopGDK ( ) )
{
dbControlCameraUsingArrowKeys ( 0, 1.5f, 2.0f );
dbPositionCamera ( 3, dbCameraPositionX ( 0 ), 350.0f, dbCameraPositionZ ( 0 ) );
dbRotateCamera ( 3, 90.0f, dbCameraAngleY ( 0 ), 0.0f );
dbPositionObject ( 4, dbCameraPositionX ( 0 ), dbCameraPositionY ( 0 ), dbCameraPositionZ ( 0 ) );
dbPositionLight ( 6, dbCameraPositionX ( 0 ), dbCameraPositionY ( 0 ), dbCameraPositionZ ( 0 ) );
if ( SC_ObjectCollision ( 4, 1 ));{
dbMoveCamera ( -1.5f );}
SC_UpdateObject ( 4 );
dbUpdateTerrain ( );
// update the screen
dbSync ( );
}
// return back to windows
return;
}
That is the code I was trying to debug, but when I tried to run it, it said error during collision check: object(4) not setup.
If you know why this is, please tell me. I am pretty sure I need to add something, but I am not sure what....