i get error C2601: 'collision' : local function definitions are illegal with this code,i know it is gonna be easy,iv done all of the C++ tutorals,here is the code,help
// 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"
int fCameraAngleX;
void collision (void);
int fCameraAngleY;
// the main entry point for the application is this function
void mouse( void );// <-- ADDED
void DarkGDK ( void )
{
dbAutoCamOff();
// turn on sync rate and set maximum rate to 60 fps
dbSyncOn ( );
dbSyncRate ( 60 );
SC_Start( );
dbLoadObject ("H-AK47-Static.x",1);
dbLoadObject ("Assault Trooper.x",2);
SC_SetupObject(1,2,2);
//moveing stuff
dbPositionObject(2,10,0,10);
dbRotateObject (2,-90,0,0);
dbRotateObject (1,0,0,0);
dbPositionObject (1,2,-2,6);
for( int i=10002; i <= 10040; i++ )
{
dbMakeObjectSphere( i,3,3,3);
dbTextureObject (i,5);
dbSetObjectLight( i,0 );
dbHideObject( i );
}
//setting camera on it
dbLockObjectOn (1);
//sizing it up
dbScaleObject ( 1, 1500, 1500, 1500 );
dbScaleObject ( 2, 15, 15, 15 );
//collition
dbAutomaticCameraCollision (0,2,2);
dbSetObjectCollisionToPolygons (2);
// our main loop
while ( LoopGDK ( ) )//; <-- PROBLEM
{
mouse( );
dbMakeMatrix (4,100,100,10,10);
// update the screen
dbSync ( );
}// <-- ADDED
}
//moving mouse
void mouse(void)//; <-- PROBLEM
{
if (dbUpKey())
{
dbMoveCamera(2);
}
if (dbDownKey())
{
dbMoveCamera(-2);
}
if (dbLeftKey())
{
dbYRotateCamera ( 0 , dbCameraAngleY( 0 ) - 90 );
dbMoveCamera(2);
}
if (dbRightKey())
{
dbYRotateCamera ( 0 , dbCameraAngleY( 0 ) + 90 );
dbMoveCamera(2);
}
fCameraAngleX = dbWrapValue ( fCameraAngleX + dbMouseMoveY ( ) * 0.2f );
fCameraAngleY = dbWrapValue ( fCameraAngleY + dbMouseMoveX ( ) * 0.2f );
//rotate camaera
dbXRotateCamera ( fCameraAngleX );
dbYRotateCamera ( fCameraAngleY );
SC_UpdateObject(2);
//more collition
void collision(void)
{
int collide=0;
int counter = 10002;
if ( dbMouseClick() == 1 )
{
//get our collision vector
float oldx = dbCameraPositionX();
float oldy = dbCameraPositionY();
float oldz = dbCameraPositionZ();
dbMoveCamera( 200 );
float x = dbCameraPositionX();
float y = dbCameraPositionY();
float z = dbCameraPositionZ();
dbMoveCamera( -200 );
collide = SC_RayCast( 0, oldx,oldy,oldz, x,y,z, 0 );
if ( collide > 0 )
{
//get the collision point
float newx = SC_GetStaticCollisionX();
float newy = SC_GetStaticCollisionY();
float newz = SC_GetStaticCollisionZ();
//get collision normal
float normx = SC_GetCollisionNormalX();
float normy = SC_GetCollisionNormalY();
float normz = SC_GetCollisionNormalZ();
//position and point a marker in the right direction
dbPositionObject( counter, newx + normx/10.0f, newy + normy/10.0f, newz + normz/10.0f );
dbPointObject( counter, newx + normx, newy + normy, newz + normz );
dbShowObject( counter );
counter++;
if ( counter > 10040 ) counter = 10002;
}
}
}
return;
}