Ok know I fixed the angles I guess i share the code i used to fix it like baxslashes. I had a hard time on this part.
this part rotates it. this is most of the rotation code that works the same. It works like this it takes the previous rotation of the angle and the last angle and subdivides it in pieces then makes the rotations on the subdivisions. The download has an exe file that i tested. put the pictures in a toolbar folder and the exe in the folder before the toolbar folder. The undo and redo options I might delete because the code is going to take a long time to iron out.
void SPRITELIST::ROTATESPRITET(int spritechildx,float angle)
{
nx=spritelist[spritechildx-50].distancex*dbCos(angle)-spritelist[spritechildx-50].distancey*dbSin(angle);
ny=spritelist[spritechildx-50].distancex*dbSin(angle)+spritelist[spritechildx-50].distancey*dbCos(angle);
nx=dbSpriteX(spriteproper.spritenumber)+nx;
ny=dbSpriteY(spriteproper.spritenumber)+ny;
char buffer[256];
dbSprite(spritechildx,nx,
ny,
spritelist[spritechildx-50].imagenumber);
dbRotateSprite(spritechildx,dbSpriteAngle(spriteproper.spritenumber));
spritelist[spritechildx-50].xposoffset=nx;
spritelist[spritechildx-50].yposoffset=ny;
spritelist[spritechildx-50].preangle=dbSpriteAngle(spritechildx);
spritelist[spritechildx-50].tickmark[spriteproper.curframe]=true;
}
void SPRITELIST::ROTATESPRITE(int spritenum,int curframe)
{
movesprite=false;
int currentsprite;
spritelist[spriteproper.spritenumber-50].tickmark[spriteproper.curframe]=true;
double xpost=dbMouseX();
double ypost=dbMouseY();
char buffer[255];
float numberoftimes=1.0;
bool foundsprite=true;
bool spritebool=true;
int spritechildx;
int spritechildy;
trueorfalset=true;
//bool foundsprite=true;
spritelist[spritenum-50].preangle=dbSpriteAngle(spritelist[spriteproper.spritenumber-50].spritenumber);
if(dbMouseClick()==1)
{
// if(ypost<dbSpriteY(spritelist[spritenum-50].spritenumber))
// {
//angle=dbSpriteAngle(spritelist[spriteproper.spritenumber-50].spritenumber);
xpost=xpost-dbSpriteX(spriteproper.spritenumber);
ypost=ypost-dbSpriteY(spriteproper.spritenumber);
spritelist[spriteproper.spritenumber-50].angle[spriteproper.curframe]=-dbATANFULL(xpost,ypost)+90;
spritebool=spritelist[spriteproper.spritenumber-50].childactive;
spritechildx=spritelist[spriteproper.spritenumber-50].childnumber;
dbText(300,300,itoa(spriteproper.anglechange,buffer,10));
dbRotateSprite(spritenum,spritelist[spriteproper.spritenumber-50].angle[spriteproper.curframe]);
while(spritebool)
{
spritelist[spritechildx-50].distancex=dbSpriteX(spritechildx)-dbSpriteX(spriteproper.spritenumber);
spritelist[spritechildx-50].distancey=dbSpriteY(spritechildx)-dbSpriteY(spriteproper.spritenumber); //system("pause");
ROTATESPRITET(spritechildx,dbSpriteAngle(spriteproper.spritenumber));
//spritelist[spritechildx-50].xpossprite[xframe]=nx;
//spritelist[spritechildx-50].ypossprite[xframe]=ny;
//spritelist[spritechildx-50].angle[xframe]=dbSpriteAngle(spriteproper.spritenumber);
if(spritelist[spritechildx-50].childactive)
{
spritebool=spritelist[spritechildx-50].childactive;
spritechildx=spritelist[spritechildx-50].childnumber;
// spritelist[spritechildx-50].distancex=dbSpriteX(spritelist[spritechildx-50].spritenumber)-dbSpriteX(spriteproper.spritenumber);
// spritelist[spritechildx-50].distancey=dbSpriteY(spritelist[spritechildx-50].spritenumber)-dbSpriteY(spriteproper.spritenumber);
}
else
{
spritebool=false;
}
}
//}
}
}
void SPRITELIST::RSPRITET()
{
float preangle=spritelist[spriteproper.spritenumber-50].angle[0];
int tempframedist;
int lasttickmark=0;
int numberoftimes=1;
bool spritebool=false;
int spritechildx;
spritechildx=spritelist[spriteproper.spritenumber-50].childnumber;
if(spritelist[spriteproper.spritenumber-50].childactive)
{
spritelist[spritechildx-50].distancex=dbSpriteX(spritelist[spritechildx-50].spritenumber)-dbSpriteX(spriteproper.spritenumber);
spritelist[spritechildx-50].distancey=dbSpriteY(spritelist[spritechildx-50].spritenumber)-dbSpriteY(spriteproper.spritenumber);
spritebool=spritelist[spritechildx-50].childactive;
while(spritebool)
{
spritechildx=spritelist[spritechildx-50].childnumber;
spritelist[spritechildx-50].distancex=dbSpriteX(spritechildx)-dbSpriteX(spriteproper.spritenumber);
spritelist[spritechildx-50].distancey=dbSpriteY(spritechildx)-dbSpriteY(spriteproper.spritenumber);
if(spritelist[spritechildx-50].childactive)
{
spritebool=spritelist[spritechildx-50].childactive;
//spritechildx=spritelist[spritechildx-50].childnumber;
}
else
{
spritebool=false;
}
}
}
for(int curtemptt=1;curtemptt<=spriteproper.numberofticks;curtemptt++)
{
if(spritelist[spriteproper.spritenumber-50].tickmark[curtemptt]==true||
curtemptt==spriteproper.numberofticks)
{
float anglettx=spritelist[spriteproper.spritenumber-50].angle[curtemptt];
anglettx=anglettx-preangle;
if(anglettx>180)
{
anglettx=(anglettx-360);
}
else if(anglettx<-180)
{
anglettx=(anglettx+360);
}
tempframedist=curtemptt-lasttickmark;
if(tempframedist!=0)
{
angletemp=anglettx/tempframedist;
}
else
{
angletemp=0;
}
for(int xframe=lasttickmark; xframe<=curtemptt;xframe++)
{
spritelist[spriteproper.spritenumber-50].angle[xframe]=spritelist[spriteproper.spritenumber-50].angle[lasttickmark];
spritelist[spriteproper.spritenumber-50].angle[xframe]=spritelist[spriteproper.spritenumber-50].angle[xframe]+numberoftimes*angletemp;
dbRotateSprite(spriteproper.spritenumber,spritelist[spriteproper.spritenumber-50].angle[xframe]);
numberoftimes=numberoftimes+1;
spritebool=spritelist[spriteproper.spritenumber-50].childactive;
spritechildx=spritelist[spriteproper.spritenumber-50].childnumber;
dbRotateSprite(spriteproper.spritenumber,spritelist[spriteproper.spritenumber-50].angle[xframe]);
while(spritebool)
{
//system("pause");
ROTATESPRITET(spritechildx,dbSpriteAngle(spriteproper.spritenumber));
spritelist[spritechildx-50].xpossprite[xframe]=nx;
spritelist[spritechildx-50].ypossprite[xframe]=ny;
spritelist[spritechildx-50].angle[xframe]=dbSpriteAngle(spriteproper.spritenumber);
if(spritelist[spritechildx-50].childactive)
{
spritebool=spritelist[spritechildx-50].childactive;
spritechildx=spritelist[spritechildx-50].childnumber;
// spritelist[spritechildx-50].distancex=dbSpriteX(spritelist[spritechildx-50].spritenumber)-dbSpriteX(spriteproper.spritenumber);
// spritelist[spritechildx-50].distancey=dbSpriteY(spritelist[spritechildx-50].spritenumber)-dbSpriteY(spriteproper.spritenumber);
}
else
{
spritebool=false;
}
}
}
preangle=spritelist[spriteproper.spritenumber-50].angle[curtemptt];
lasttickmark=curtemptt;
numberoftimes=1;
curtemptt++;
}
}
}
Developer of Space Chips, pianobasic, zipzapzoom, and vet pinball apps. Developed the tiled map engine seen on the showcase. Veteran for the military.