const width = 800; const height = 600; const cards = []; let cardDragging = null; function setup() { createCanvas(width, height); angleMode(DEGREES); imageMode(CENTER); rectMode(CENTER); frameRate(60); cursor(HAND); cards.push(new BaseCard(100, 100, 40, 60, 5)); cards.push(new BaseCard(200, 100, 40, 60, 5)); cards.push(new BaseCard(300, 100, 40, 60, 5)); } function draw() { background(0); drawGrid(); cards.forEach((card) => card.update()); for (let i = cards.length - 1; i >= 0; i--) { cards[i].draw(); } } function mouseReleased() { cardDragging = null; } function mouseDragged() { if (cardDragging) cardDragging.followMouse(); }