From fda9a75922304ae8a98103ef7803763de9f10fc9 Mon Sep 17 00:00:00 2001 From: Lev Date: Sat, 17 Apr 2021 19:00:07 -0500 Subject: [PATCH] Update changed to array of buttons --- .../Topic 1/1.5.1/sketch.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/CM2030 Graphics Programming/Topic 1/1.5.1/sketch.js b/CM2030 Graphics Programming/Topic 1/1.5.1/sketch.js index 0b7f028..f9b9525 100644 --- a/CM2030 Graphics Programming/Topic 1/1.5.1/sketch.js +++ b/CM2030 Graphics Programming/Topic 1/1.5.1/sketch.js @@ -4,22 +4,30 @@ let locY = 200; let w = 200; let h = 100; let myButton = null; +let buttonArray = []; function setup() { createCanvas(900, 600); - myButton = new Button(200, 200, 200, 100); + buttonArray.push(new Button(200, 200, 200, 100)); + buttonArray.push(new Button(300, 300, 200, 100)); } function draw() { background(220); - myButton.draw(); + for(let i=0; i