Skip to content

Commit

Permalink
added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
billythemusical committed May 27, 2021
1 parent db65aa2 commit 58cf678
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
Binary file modified p5-ableton/.DS_Store
Binary file not shown.
Binary file modified p5-ableton/basic-percussion/receive-osc.amxd
Binary file not shown.
25 changes: 14 additions & 11 deletions p5-ableton/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,35 @@ function setup() {
createCanvas(800, 600);
setupOsc(8000, 12000);

x = random(width)
y = random(height)
x = random(width);
y = random(height);

xSpeed = 5
ySpeed = 6
xSpeed = 5;
ySpeed = 6;

}

function draw() {
background(0);

// ball is a circle
ellipse(x, y, 100, 100)
// ball is an ellipse
ellipse(x, y, 100, 100);

x+=xSpeed
y+=ySpeed
// move the ball location
x+=xSpeed;
y+=ySpeed;

// check if the ball hits a wall and send a message if so
if(x > width || x < 0) {
if (x > width || x < 0) {

xSpeed *= -1
sendOsc('message', 1);
}

if(y > height || y < 0) {
} else if (y > height || y < 0) {

ySpeed *= -1
sendOsc('message', 1);

}

}
Expand Down

0 comments on commit 58cf678

Please sign in to comment.