Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*MAKE THESE BUBBLES DIFFERENT SIZES AND COLORS */
- var bubbles = [];
- function setup() {
- createCanvas(400, 400);
- }
- function draw() {
- background(220);
- for(var i = 0; i < bubbles.length; i++){
- bubbles[i].show();
- bubbles[i].move();
- }
- }
- function mouseClicked(){
- var b = new Ball();
- bubbles.push(b);
- }
- class Ball{
- constructor(){
- this.x = mouseX;
- this.y = mouseY;
- }
- move(){
- this.x += random(-2,2);
- this.y += random(-2,2);
- }
- show(){
- //this.move();
- circle(this.x, this.y, 30);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment