Modify a text file: $/p1x2172020.pde
$/p1x2172020.pde
//Project #1 example //J.O.P //Declare vars. for ball var bx; //X pos. of ball var by; //Y pos. of ball var bSize; //Ball size var xSpeed; //Horizontal speed var ySpeed; //Vertical speed function setup() { createCanvas(500, 500); //Initialize variables for ball bx = width/2; by = height/2; bSize = width/8; xSpeed = 2; ySpeed = 3; } function draw() { background(0, 0, 0); //Draw ellipse ellipse ( bx, by, bSize, bSize); //Ellipse's horizontal movement bx += xSpeed; //Ellipse's Vertical movement by += ySpeed; //Make ellipse reverse course for 'X' position if(bx >= width - bSize/2 || bx <= 0 + bSize/2){ xSpeed *= -1; //Movement of 'X' is reversed fill(random(255), random(255), random(255), random(255)); //Ellipse changes color randomly for 'X' pos. } //Make ellipse reverse course for 'Y' position if (by >= height - bSize/2 || by <= 0 + bSize/2){ ySpeed *= -1; //Movement of 'Y' is reversed fill(random(255), random(255), random(255), random(255)); //Ellipse changes color randomly for 'Y' pos. } textSize(20, 20); //Text size for all texts text("Jose Olvera", 0, 17); text("Will it hit the corner?...", 50, 100); //Questioning text("Decide when it'll reach it...", 250, 270); //Comment text("Choose wisely...", 100, 400); //Comment }