valiamaximova1

rect blue and red

Mar 8th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. int x = 0;
  2. int y = 0;
  3.  
  4. void setup() {
  5.  size(500,500);
  6.  background(#1437F5);
  7.   fill(#F51414);
  8. }
  9.  
  10. void draw() {
  11.  
  12.   for (int i = 0; i < 10; i++) {
  13.   if (i % 2 == 0) {
  14.     if (y == 0|| y == 100 || y == 200 || y == 300 || y == 400 || y == 500) {
  15.        fill(#F51414);
  16.    rect(x,y, 50, 50);
  17.     }
  18.    
  19.    x += 50;
  20.    if (x >= 500) {
  21.      x = 0;
  22.      y += 50;
  23.    }
  24.    
  25.   } else if (i % 2 == 1) {
  26.    
  27.     if (y == 50 || y == 150 || y == 250 || y == 350|| y == 450) {
  28.           fill(#F51414);
  29.           rect(x,y, 50, 50);
  30.     }
  31.      
  32.     x += 50;
  33.    if (x >= 500) {
  34.      x = 0;
  35.      y += 50;
  36.    }
  37.   }
  38.  }
  39. }
Add Comment
Please, Sign In to add comment