ok, now that i have all of that figured out, now i have a new problem. i am having a problem with another angle related problem
the problem lies in the third collision test. the ball does not come back
here is my code
// 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"
//prototypes for the functions i will use
void PaddleUpdate();
void CreateField();
//Camera coordinates used by the program
float XCoord[359];
float YCoord[359];
int Angle = 0;
int i = 0;
// the main entry point for the application is this function
void DarkGDK ( void )
{
while ( Angle <= 90 )
{
XCoord[Angle] = dbSin(Angle) * 100;
Angle++;
}
while ( Angle <= 180 )
{
i = 90 - ( Angle - 90);
XCoord[Angle] = XCoord[i] * -1;
Angle++;
}
while ( Angle <= 270 )
{
i = 180 - ( Angle - 180 );
XCoord[Angle] = XCoord[i];
Angle++;
}
while ( Angle <= 359 )
{
i = 360 - Angle;
XCoord[Angle] = XCoord[i] ;
Angle++;
}
Angle = 0;
i = 0;
while ( Angle <= 90 )
{
YCoord[Angle] = dbCos(Angle) * 100;
Angle++;
}
while ( Angle <= 180 )
{
i = 90 - ( Angle - 90 );
YCoord[Angle] = YCoord[i] ;
Angle++;
}
while ( Angle <= 270 )
{
i = ( 180 - ( Angle - 180));
YCoord[Angle] = YCoord[i] * -1;
Angle++;
}
while ( Angle <= 359 )
{
i = ( 270 - ( Angle - 270));
YCoord[Angle] = YCoord[i];
Angle++;
}
// turn on sync rate and set maximum rate to 60 fps
dbAutoCamOff();
dbSyncOn ( );
dbSyncRate ( 60 );
dbPositionCamera ( 0 , 0, -200 );
dbPointCamera ( 0 , 0 , 0 );
dbSetGlobalCollisionOn();
CreateField();
// our main loop
while ( LoopGDK ( ) )
{
PaddleUpdate();
// update the screen
dbSync ( );
}
// return back to windows
return;
}
void PaddleUpdate()
{
dbPositionObject ( 2 , dbObjectPositionX( 1 ), -100 , dbObjectPositionX(1));
dbPositionObject ( 3 , dbObjectPositionX( 1 ), 100 , dbObjectPositionX(1));
dbPositionObject ( 4 , 150 , dbObjectPositionY(1) , dbObjectPositionX(1));
dbPositionObject ( 5 , -150, dbObjectPositionY(1) , dbObjectPositionX(1));
dbPositionObject ( 6 , dbObjectPositionX(1) , dbObjectPositionY(1) , 175 );
dbPositionObject ( 7 , dbObjectPositionX(1) , dbObjectPositionY(1) , -175 );
dbMoveObject ( 1 , 3 );
if (dbObjectCollision(1,2) || dbObjectCollision(1,3) == 1)
{
dbRotateObject( 1 , dbObjectAngleX(1) * -1 , dbObjectAngleY(1) , 0);
}
if (dbObjectCollision(1,4) || dbObjectCollision(1,5) == 1)
{
dbRotateObject( 1 , dbObjectAngleX(1) , dbObjectAngleY(1) * -1 , 0);
}
if (dbObjectCollision(1,6) || dbObjectCollision(1,7) == 1)
{
dbRotateObject( 1 , dbObjectAngleX(1)*-1 , dbObjectAngleY(1) , 0);
}
}
void CreateField()
{
dbMakeObjectSphere ( 1 , 10 );
dbMakeObjectBox ( 2 , 40 , 10 , 40 );
dbMakeObjectBox ( 3 , 40 , 10 , 40 );
dbMakeObjectBox ( 4 , 10 , 40 , 40 );
dbMakeObjectBox ( 5 , 10 , 40 , 40 );
dbMakeObjectBox ( 6 , 40 , 40 , 10 );
dbMakeObjectBox ( 7 , 40 , 40 , 10 );
dbPositionObject ( 1 , 0 , 0 , 0 );
dbPositionObject ( 2 , 0 , -100 , 0 );
dbPositionObject ( 3 , 0 , 100 , 0 );
dbPositionObject ( 4 , 125 , 0 , 0 );
dbPositionObject ( 5 , -125 , 0 , 0 );
dbPositionObject ( 6 , 0 , 0 , 175 );
dbPositionObject ( 7 , 0 , 0 , -175 );
dbRotateObject ( 1 , 45 , 45 , 0 );
}
Pimpin aint eazy