heres an interesting error i don't understand even 1%. I decided to make my ship game pseudo 3d and reminiscent of Gradius. All well and good. Except im using 2 limbs. One to mark the position of the booster particle effect. (which will have another limb to help orient the direction to fire it). and another limb to orient the front for shooting. Now the problem is im getting strange conflicts with my ship object and its limbs. heres my source:
Main:
#include "DarkGDK.h"
#include "player.h"
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );
dbAutoCamOff();
//initial player setup
dbLoadObject("models/Rune_1.3ds",1);
dbPositionCamera(-300,0,-200);
dbPointCamera(dbObjectPositionX(1),dbObjectPositionY(1),dbObjectPositionZ(1));
int pitch=dbObjectAngleX(1);
int origin=dbObjectAngleX(1);
int player_x=dbObjectPositionX(1);
int player_y=dbObjectPositionY(1);
int player_z=dbObjectPositionZ(1);
//create particles for booster
dbMakeObjectSphere(2,10);
dbMakeMeshFromObject(2,2);
dbDeleteObject(2);
dbAddLimb(1,1,2);
dbAddLimb(1,2,2);
dbDeleteMesh(2);
dbOffsetLimb(1,1,0,0,20);
dbOffsetLimb(1,2,0,0,-20);
dbColorObject(1,RGB(255,0,0));
dbColorLimb(1,3,RGB(0,255,0));
dbColorLimb(1,2,RGB(0,0,255));
// our main loop
while ( LoopGDK ( ) )
{
pitching(pitch,origin);//handles ship pitching
v_move(player_x,player_y,player_z);//moves the ship up and down
refresh(pitch,player_x,player_y,player_x);//draws the ship
// update the screen
dbSync ( );
}
// return back to windows
return;
}
player.h:
#include "pitching.h"
#include "refresh.h"
#include "v_move.h"
pitching.h:
#define PITCHING
void pitching(int& pitch, int origin)
{
if( dbUpKey() && pitch < (origin+30) )//check and handle the pitching of the ship
{
pitch++;
}
else
{
if( dbDownKey() && pitch > (origin-30) )
{
pitch--;
}
else
{
if(pitch>origin)
{
pitch--;
}
else
{
if(pitch<origin)
{
pitch++;
}
}
}
}
};
v_move.h:
#define V_MOVE
void v_move(int& player_x,int& player_y, int& player_z)
{
if(dbUpKey()&& player_y<200 )
{
player_y++;
}
else
{
if(dbDownKey()&& player_y>-200 )
{
player_y--;
}
}
}
refresh.h:
#define REFRESH
void refresh(int& pitch, int& player_x, int& player_y, int& player_z)
{
dbRotateObject(1,pitch,0,0);
dbPositionObject(1,player_x,player_y,player_x);
}
now it worked flawlessly...until i added those limbs. When I added the limbs, all of a sudden limb#1 was being treated as the root object. But limb number one was referring to both the root object(the ship) and the limb. Limb number 2 referred to the second limb. and number 3 refrerred to just the ship. I didnt even make a number 3!! i colored the limbs to check which was which and sure eneough the id's are all messed up. any ideas??
Your signature has been erased by a mod - please reduce it to 600x120