We are trying to rotate our rainbow image around our cat image. It is a game rendition of snake that we are creating, so we want the rainbows to follow the cat as it moves around the screen. Instead our rainbow orients itself on the left side of the rainbow and rotates around itself.
Here is our code for the tail class which is the rainbow.
class Tail {
char direction;
float raindiameter;
float X;
float Y;
float angleX;
float angleY;
float angleZ;
Tail() {
raindiameter = 20;
X = cat.catX;
Y = cat.catY;
angleX = 0;
angleY = 0;
angleZ = 0;
}
void display() {
pushMatrix();
imageMode(CENTER);
translate(width/2, height/2);
translate(strt1-20, strt2-20);
translate(X-17, Y+20);
rotateX(angleX);
rotateY(angleY);
rotateZ(angleZ);
image(t, 0, 0, raindiameter, raindiameter);
popMatrix();
}
void move() {
switch(direction) {
case 'N':
angleZ = -PI/2;
angleY = 0;
angleX = 0;
// translate(X + 30, Y + 30); attempt to rotate/move