Dimenticare

Chess board draw event

Jun 23rd, 2015
715
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // void drawBoard();
  2. // Loops through the Board array, drawing the squares as needed.
  3.  
  4. // You could use a sprite to represent the chess board, but this is a little more memory effecient.
  5.  
  6. var i, j;
  7. for (i=0; i<8; i+=1){
  8.     for (j=0; j<8; j+=1){
  9.         if ((i mod 2 ==0&&j mod 2==0)||(i mod 2 ==1&&j mod 2==1))
  10.             draw_set_color(c_white);
  11.         else
  12.             draw_set_color(c_red);
  13.         draw_rectangle(64+global.size*i, 32+global.size*j, 64+global.size*(i+1), 32+global.size*(j+1), false);
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment