White Belt Core Programming Code

March 1, 2015 by Uncategorized No Comments

Hi All,

 

Below is the code created in the older group white belt core programming class,

 

// position of the ball
var x = 20;
var w = 25;
// how far the ball moves every time
var speed = 5;

var draw = function() {
background(202, 255, w);

fill(66, 66, 66);
ellipse(x, 200, w, w);

if(x === 350){
speed -= 5;
w += 5;
}

if(x === 15){
speed += 5;
w += 5;
}

// move the ball
x = x + speed;
};