Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ####
- # Author: Zachary Williams
- # Written in Java using the Processing framework
- # Purpose: The program takes a 600 x 600 canvas and makes it a 10x10 grid.
- # You can provide coordinate pairs in blx (block x) and bly (block y).
- # And the program will rectangles and then fill them in so you can draw shapes or designs.
- ####
- int step = 0;
- int grid = 60;
- int [] blx = { 3, 4, 4, 3, 7, 8, 7, 8, 5, 6, 4, 5, 6, 7, 4, 5, 6, 7, 4, 7};
- int [] bly = { 3, 3, 4, 4, 3, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8};
- int valx;
- int valy;
- void setup()
- {
- size(600, 600);
- background(0, 255, 0);
- }
- void draw()
- {
- noStroke();
- for(int i = 0; i <= 10; i++)
- {
- for(int j = 0; j <= 10; j++)
- {
- for(int val = 0; val < blx.length; val++)
- {
- if(blx[val] == i && bly[val] == j)
- {
- fill(0);
- print(i * grid);
- rect(i * grid, j * grid, grid, grid);
- }
- }
- line(i * grid, j * grid, i * grid, 0);
- line(0, j * grid, i * grid, j * grid);
- }
- noLoop();
- }
- //for(int i = 0; i <= width; i += grid)
- //{
- // line(i, height, i, 0);
- //}
- //for(int j = 0; j <= height; j += grid)
- //{
- // line(0, j, width, j);
- //}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement