Hi, I have a school project about to make a Tower of Hanoi game, I’ve made all the rings and stuff, but I have very little knowledge about dragging and other interaction options in Processing. I haven’t finished, but here is the rings. I’m not sure how to make the rings draggable.
int x = 100;
// represent the disks in each tower
int[] tower1 = {4, 3, 2, 1};
int[] tower2 = {0, 0, 0, 0};
int[] tower3 = {8, 0, 0, 0};
float r, g, b;
void setup() {
size(600, 400);
rectMode(CENTER);
r = random(0, 256);
g = random(0, 256);
b= random(0, 256);
}
void draw() {
background(255);
fill(r, g, b);
//rect(400, 350, 166, 20);
int y = 350;
int yTwo = 350;
int sizeTwo = 166;
y = 350;
// write a loop to loop 4 times
for (int i = 0; i<tower1.length; i++) {
int size = tower1[i] * 40;
rect(x, y, size, 20, 7);
y -= 50;
r=random(0, 256);
g=random(0, 256);
b =random(0, 256);
}
y = 350;
for (int i = 0; i<tower2.length; i++) {
int size = tower2[i] * 40;
rect(270, y, size, 20, 7);
y -= 50;
r=random(0, 256);
g=random(0, 256);
b =random(0, 256);
}
for (int u=0; u< tower3.length; u++) {
}
}