Skip to content

Commit

Permalink
I added collision for the rectangle and made the shapes move randomly.
Browse files Browse the repository at this point in the history
  • Loading branch information
untangledwilliam committed Aug 5, 2019
1 parent eabedaf commit 55ffc5d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sketches/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}

function getRandomArbitrary(min, max) {
return Math.random() * (max - min) + min;
}

function bounceCheck() {
console.log(rectX);
console.log(rectY);
Expand Down Expand Up @@ -39,8 +43,8 @@ let rectX = 150;
let rectY = 150;
let rectXSize = 100;
let rectYSize = 100;
let rectXVelocity = 2;
let rectYVelocity = 2;
let rectXVelocity = getRandomArbitrary(-5, 5);
let rectYVelocity = getRandomArbitrary(-5, 5);

// SETUP AND DRAW

Expand Down

0 comments on commit 55ffc5d

Please sign in to comment.