this is my code a little messy:
float ship_Pos_X=250,
ship_Pos_Y=250,
angle_of_the_Ship=0,
d1=55,
d2=30,
angle_of_wing=0.7;
float x=0,
y=0,
x1=0,
y1=0,
x3=0,
y3=0;
float ship_Pos_X1=ship_Pos_X,
ship_Pos_Y1=ship_Pos_Y,
angle_both_first=0,
angle_both_second=0;
void setup()
{
size(1000, 1000);
}
void draw()
{
calcPoints();
drawSHIP();
Move_Ship();
}
void calcPoints()
{
x =cos(angle_of_the_Ship)*d1;
y =sin(angle_of_the_Ship)*d1;
angle_both_first=angle_of_the_Ship+angle_of_wing;
angle_both_second=angle_of_the_Ship-angle_of_wing;
x1=cos(angle_both_first)*d2;
y1=sin(angle_both_first)*d2;
x3=cos(angle_both_second)*d2;
y3=sin(angle_both_second)*d2;
}
void drawSHIP()
{
fill(255);
quad(ship_Pos_X1, ship_Pos_Y1, ship_Pos_X1-x1, ship_Pos_Y1-y1, ship_Pos_X1+x, ship_Pos_Y1+y, ship_Pos_X1-x3, ship_Pos_Y1-y3);
if (key=='d'||key=='l') {angle_of_the_Ship+=0.01;}
if (key=='a'||key=='j') {angle_of_the_Ship-=0.01;}
}
void Move_Ship()
{
ship_Pos_X1+=1;
ship_Pos_Y1+=1;
if (ship_Pos_X1>width){ship_Pos_X1=ship_Pos_X;}
if (ship_Pos_Y1>height){ship_Pos_Y1=ship_Pos_Y;}
}
void keyPressed()
{
}
like when I pressed ādā all of the ship will turn slowly to the right and will create a movement in a circle. I learn everything online so some of them may sound stupid. Hop you can help me.