Hey guys, I hope you are having a nice pre-christmas time…
For my university homework I’ll have to draw an advent calendar which (in the first step) has to be drawn by a loop and a draw_advent_calendar_door(float x, float y, int number) function.
It draws the windows quiet nicely, but sadly I am stuck displaying the right number. Everything, including the constrain function, I’ve tried before does not work for me so far.
I would like to ask for some Ideas, how I can better try to solve this. Please do not provide a definite solutions as this is my homework and I’ll have to solve it myself.
Thank you in advance!
PS: I forgot to mention that we have doors from day 1 to day 24.
int doorNr = 1;
void setup() {
size(777, 500);
background(0, 150, 0);
}
void draw() {
rectMode(CENTER);
for (float i = 111; i <= 666; i += 111) {
for (float a = 100; a <= 400; a += 100) {
//for (int e = 1; e <= 24; e++) {
draw_advent_calendar_door(i, a, doorNr);
// }
}
}
doorNr++;
constrain(doorNr, 1, 24);
}
void draw_advent_calendar_door(float x, float y, int number) {
fill(255);
rect(x, y, 75, 75);
fill(200, 0, 0);
textAlign(CENTER, CENTER);
textSize(60);
text(number, x, y-10);
}