‘’‘processing’‘’
//position
float xorigin, yorigin;
//origin position
float xPos, yPos;
//penguin position
//wing animation
float wingangle;
float wingspeed;
float upperwinglimit;
float lowerwinglimit;
boolean winglimitBO;
void setup() {
//varibles
//position
xPos = 0;
yPos = 0;
xorigin = 400;
yorigin = 400;
//Wings
wingangle = PI/16;
upperwinglimit=PI/12;
lowerwinglimit=PI/20;
wingspeed = PI/4096;
size(800,800);
void draw() {
//setup
translate(xorigin,yorigin);
.
pushMatrix();
rotate(wingangle);
ellipse(xPos-90,yPos+120,40,180); // wing left
popMatrix();
pushMatrix();
rotate(-wingangle);
ellipse(xPos+90,yPos+120,40,180); // wing right
popMatrix();
.
if (wingangle>upperwinglimit) {
winglimitBO = false;
}
if (winglimitBO) {
wingangle = wingangle + wingspeed;
}
if (winglimitBO == false) {
wingangle = wingangle - wingspeed;
}
if (wingangle<lowerwinglimit) {
winglimitBO = true;
}
This isn’t the full code but it is all the code relating to the position/angle of the wings the wings flap up and down like they are meant to when stationary but if you change the X position of the penguin through something such as xPos += 1; then the wings will start moving up and down without any change to the Y axis being made and I cant figure out why. I was wondering if there is an error or a way to fix this?