You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's a basic model of how I'm doing this simply:
// Learning Processing// Daniel Shiffman// http://www.learningprocessing.com// Exercise 8-5: Rewrite the gravity example from Chapter 5 using objects with a Ball class. // Include two instances of a Ball object.// Ball constuctorclassBall{constructor(x,y,w){this.x=x;// x location of square this.y=y;// y location of square this.w=w;// speed of square this.speed=0;// size}display(){// Display the square fill(175);stroke(0);ellipse(this.x,this.y,this.w,this.w);}update(){// Add speed to locationthis.y=this.y+this.speed;// Add gravity to speedthis.speed=this.speed+gravity;// If square reaches the bottom // Reverse speed if(this.y>height){this.speed=this.speed*-0.95;}}}
The text was updated successfully, but these errors were encountered:
Here's a basic model of how I'm doing this simply:
The text was updated successfully, but these errors were encountered: