I know i have already posted but its been like 3 days with no response so i thought it was probably time to try again.
I know this is the third request for help in the last week or so, but my program has yet another problem. I want a new sphere to be created when two spheres hit each other, but all that happens is a static sphere just sits there.
#include \"DarkGDK.h\"
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );
int Sid = 1;
int Sx [100];
int Sz [100];
int Sg [100];
int SBo;
int SRo;
int Sm = 2;
int Sidc = 1;
int Smx [100];
int Smz [100];
int Nx = 0;
int Nz = 0;
Sg[1] = 0;
Sg[2] = 1;
int Setup = 1;
int MN = 0;
dbSetAmbientLight ( 0 );
dbRandomize ( 2 );
dbMakeObjectCube (201, 100);
dbPositionObject (201, 0, 0, 0);
dbScaleObject (201, 1000, 0.5, 1000);
dbColorObject (201, dbRGB ( 0, 0, 0 ));
dbMakeObjectCube (202, 100);
dbPositionObject (202, 500, 0, 0);
dbScaleObject (202, 40, 50, 1000);
dbMakeObjectCube (203, 100);
dbPositionObject (203, -500, 0, 0);
dbScaleObject (203, 40, 50, 1000);
dbMakeObjectCube (204, 100);
dbPositionObject (204, 0, 0, 500 );
dbScaleObject (204, 1040, 50, 40);
dbMakeObjectCube (205, 100);
dbPositionObject (205, 0, 0, -500 );
dbScaleObject (205, 1040, 50, 40);
while ( LoopGDK ( ) ) {
dbPositionCamera ( 0, 1000, 0 );
dbPointCamera ( 0, 0, 0 );
// Make initial spheres
if (Setup == 1) {
if (Sid <= 2) {
SBo = 0;
SRo = 0;
Sx[Sid] = dbRND ( 500 );
Sz[Sid] = dbRND ( 500 );
Smx[Sid] = dbRND ( 10 );
Smz[Sid] = 10 - Smx[Sid];
dbMakeObjectSphere ( Sid, 50 );
dbPositionObject ( Sid, Sx[Sid], 0, Sz[Sid] );
if (Sg[Sid] == 0){SRo = 1000;}
if (Sg[Sid] == 1){SBo = 1000;}
dbColorObject ( Sid, dbRGB ( SRo, 0, SBo ));
Sid = Sid + 1;
Sm = Sm + 1;
}}
if (Sid > 2) {
Setup = 0;
Sm = 2;
Sid = 1;
}
// Make initial spheres
//////////////////////////////////////////////////////////////////////////////////////
// Run the spheres
if ( Setup == 0 ) {
if (Sid <= Sm) {
if (dbObjectCollision ( Sid, 202 )) {
Smx[Sid] = Smx[Sid] * -1;
Smz[Sid] = Smz[Sid] * 1;
}
if (dbObjectCollision ( Sid, 203 )) {
Smx[Sid] = Smx[Sid] * -1;
Smz[Sid] = Smz[Sid] * 1;
}
if (dbObjectCollision ( Sid, 204 )) {
Smx[Sid] = Smx[Sid] * 1;
Smz[Sid] = Smz[Sid] * -1;
}
if (dbObjectCollision ( Sid, 205 )) {
Smx[Sid] = Smx[Sid] * 1;
Smz[Sid] = Smz[Sid] * -1;
}
Sx[Sid] = dbObjectPositionX ( Sid );
Sz[Sid] = dbObjectPositionZ ( Sid );
dbPositionObject ( Sid, ( Sx[Sid] + Smx[Sid] ), 0,( Sz[Sid] + Smz[Sid] ) );
for (Sidc; Sidc < Sm; Sidc++) {
if ( dbObjectCollision ( Sidc, Sid ) ) {
MN = 1;
Smx[Sidc] = Smx[Sidc] * - 1;
Smx[Sidc] = Smz[Sidc] * - 1;
Smz[Sid] = Smx[Sid] * - 1;
Smz[Sid] = Smx[Sid] * - 1;
Nz = Sz[Sid] - 30;
Nx = Sx[Sid];
}}
Sid = Sid + 1;
}}
if (MN == 1) {
Sm = Sm + 1;
Sid = Sm;
SBo = 0;
SRo = 0;
Sx[Sid] = Nx;
Sz[Sid] = Nz;
Smx[Sid] = dbRND ( 10 );
Smz[Sid] = 10 - Smx[Sid];
Sg[Sid] = dbRND ( 1 );
dbMakeObjectSphere ( Sid, 50 );
dbPositionObject ( Sid, Sx[Sid], 0, Sz[Sid] );
if (Sg[Sid] == 0){SRo = 1000;}
if (Sg[Sid] == 1){SBo = 1000;}
dbColorObject ( Sid, dbRGB ( SRo, 0, SBo ));
MN = 0;
}
// Run the spheres
dbSync();
}
return;
}
I have been trying to see what the problem is for about a week now, so can any of you clever sorts please tell me what on earth is wrong.
True geeks live forever, or die trying.