Move rect's across the screen - stacker game.
in
Programming Questions
•
21 days ago
So I can move the blocks by adjusting the values in the array (which will help later) but I am having trouble with the time interval. How can I get it to move every .5s (for example) without affecting (or stopping) the rest of the program?
The space is 7x15 (with a space at the bottom) and the rects are multiplied my 1-7 depending on which column and 1-15 depending on the row.
This is the relevant function but let me know if I should include the rest of the code. It is just the background and a button that is yet to be given the 'stop' part.
- void moveLights()
- {
- int rowNum[] = {2,3,4};
- //These will show rects 2,3 and 4. Adjust for desired column number.
- for (int lights = 0;lights<=rowNum.length-1;lights++)
- {
- rect(rowNum[lights]*(width/7)-(width/14),(15*(height-50)/15)-((height-50)/30),width/7,(height-50)/15);
- //First val (^) rowNum is column number '15' (^) represents row num - 15 is the bottom row
- }
- }
1