Guest User

Untitled

a guest
Dec 9th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. void createNewTopWallBlocks() {
  2. createNewBlock(0, 0, true);
  3. createNewBlock(0, 1, false);
  4. createNewBlock(7, 0, true);
  5. createNewBlock(7, 1, false);
  6. }
  7. void createNewBlock(int x, int y, bool border) {
  8. if (border)
  9. blocks[x][y] = 5;
  10. else
  11. blocks[x][y] = 6;
  12. }
  13. void scrollAllBlocks() {
  14. for (int y = 5; y >= 0; y--) {
  15. for (int x = 0; x < 8; x++) {
  16. blocks[x][y+1] = blocks[x][y];
  17. blocks[x][y+2]=blocks[x][y+1];
  18. }
  19. }
  20. }
  21. void renderBlocks() {
  22.  
  23. for (int x = 0; x < 8; x++) {
  24. for (int y = 0; y < 8; y++) {
  25. switch (blocks[x][y]) {
  26. case 0:
  27. break;
  28. case 1:
  29. case 5:
  30. AberLED.set(0, y, RED);
  31. AberLED.set(7, y, RED);
  32. break;
  33. case 6:
  34. AberLED.set(0, y, BLACK);
  35. AberLED.set(7, y, BLACK);
  36. break;
  37. default: // anything else must be yellow
  38. AberLED.set(x, y, YELLOW);
  39. }
  40. }
  41. }
Add Comment
Please, Sign In to add comment