My if statement is not working: I tried to make a physics lab but the if statement doesn't work (in Khan Academy). Link: https://www.khanacademy.org/computer-programming/physics-lab/5267217236312064 My whole code:
var y = 300;
var gravity = 0.5;
var velocity = 1;
var update;
var grav = gravity;
var vel = velocity;
draw = function() {
background(0, 0, 0);
fill(255, 255, 255);
ellipse(300, y, 10, 10);
if (y === 5) {
noLoop();
}
y += grav;
grav += 0.5;
};
Aucun commentaire:
Enregistrer un commentaire