jai
YaBB Newbies
Offline
Posts: 28
Re: OK...had a thought.
Reply #1 - Feb 14th , 2007, 5:52pm
Ive started to make the grid (not sure if this is long winded) void setup() { size (430, 430); } void draw () { //first line rect(25, 25, 50, 50); rect(80, 25, 50, 50); rect(135, 25, 50, 50); rect(190, 25, 50, 50); rect(245, 25, 50, 50); rect(300, 25, 50, 50); rect(355, 25, 50, 50); //second line rect(25, 80, 50, 50); rect(80, 80, 50, 50); rect(135, 80, 50, 50); rect(190, 80, 50, 50); rect(245, 80, 50, 50); rect(300, 80, 50, 50); rect(355, 80, 50, 50); //third line rect(25, 135, 50, 50); rect(80, 135, 50, 50); rect(135, 135, 50, 50); rect(190, 135, 50, 50); rect(245, 135, 50, 50); rect(300, 135, 50, 50); rect(355, 135, 50, 50); //fourth line rect(25, 190, 50, 50); rect(80, 190, 50, 50); rect(135, 190, 50, 50); rect(190, 190, 50, 50); rect(245, 190, 50, 50); rect(300, 190, 50, 50); rect(355, 190, 50, 50); //fifth line rect(25, 245, 50, 50); rect(80, 245, 50, 50); rect(135, 245, 50, 50); rect(190, 245, 50, 50); rect(245, 245, 50, 50); rect(300, 245, 50, 50); rect(355, 245, 50, 50); //sixth line rect(25, 300, 50, 50); rect(80, 300, 50, 50); rect(135, 300, 50, 50); rect(190, 300, 50, 50); rect(245, 300, 50, 50); rect(300, 300, 50, 50); rect(355, 300, 50, 50); //seventh line rect(25, 355, 50, 50); rect(80, 355, 50, 50); rect(135, 355, 50, 50); rect(190, 355, 50, 50); rect(245, 355, 50, 50); rect(300, 355, 50, 50); rect(355, 355, 50, 50); } Then I tried implementing the 'key' code to change each of the blocks a different colour with a corresponding 'key' but didn't manage to do it. void setup() { size (430, 430); } void draw () { //first line if (keyPressed) { if (key == 'b' || key == 'B') { fill (0); } } else { fill (255); } rect(25, 25, 50, 50); } I can only do the first one and not sure how to go about doing the rest. I have a feeling that its quite simple but I can't find any examples on how to do it. Can anyone help?