xxxxxxxxxx
29
/* Credit: The Nature of Code
Daniel Shiffman
http://natureofcode.com */
var position;
var velocity = 1;
function setup() {
createCanvas(400, 400);
fill(255, 174, 0);
stroke(255, 136, 0);
position = createVector(100, 100);
console.log(position.x);
console.log(position.y);
/* Here, we are using a class Vector that contains
*/
}
function draw() {
background(248, 232, 255);
ellipse(position.x, position.y, 20, 20);
position.add(velocity); // why is my ball only moving horizontally?
}