Advertisement
1vannn

BlockDodge

Jun 10th, 2014
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.68 KB | None | 0 0
  1. /*
  2. Version 0.2:
  3. Changelog: http://pastebin.com/Kp6Srk6k
  4. Logo.png: http://imgur.com/3gPDZu5
  5. */
  6. int[] align = {
  7.   0, 200, 400
  8. };
  9. int[] blockSize = {
  10.   600, 50
  11. };
  12. int[] velocity = {
  13.   10, 20, 30, 40, 50, 60
  14. };
  15. int[] BarX = {
  16.   -600
  17. };
  18. int[] BarY = {
  19.   70
  20. };
  21. int[] colors = {
  22.   int(random(255)), int(random(255)), int(random(255))
  23. };
  24.  
  25. boolean menu_firstRun = true;
  26. boolean game = false;
  27. int m_velocity = int(random(20));
  28. int score = 0;
  29. int speedLevel = 1;
  30. int speed = 0;
  31. int menuStage = 1;
  32. PImage img1;
  33.  
  34.  
  35. void setup() {
  36.   img1 = loadImage("logo.png");
  37.   size(600, 600);
  38.   smooth();
  39. }
  40. void draw() {
  41.   background(9, 125, 154);
  42.   setupFrame();
  43. }
  44. void mouseClicked() {
  45. }
  46. void setupFrame() {
  47.   if (game) {
  48.     checkScore();
  49.   }
  50.   else { // the menu
  51.     imageMode(CENTER);
  52.     image(img1, width/2, 40);
  53.     drawMenuBars();
  54.   }
  55. }
  56. void checkScore() {
  57.   if (score == 0) {
  58.     speed = velocity[speedLevel];
  59.   }
  60.   else if (score >= 5) {
  61.   }
  62. }
  63. void drawMenuBars() {
  64.   System.out.println("X: " + BarX[0] + " | Y: " + BarY[0]);
  65.   System.out.println(m_velocity);
  66.   if (menu_firstRun) {
  67.     System.out.println("Color: " + colors[0] + " | Color: " + colors[1] + " | Color: " + colors[2]);
  68.     menu_firstRun = false;
  69.   }
  70.   if (menuStage == 1) {
  71.     fill(colors[0], colors[1], colors[2], 129);
  72.     rect(BarX[0], BarY[0], blockSize[0], blockSize[1]);
  73.   }
  74.   if (BarX[0] >= width) {
  75.     BarX[0] = -600;
  76.     colors[0] = int(random(255));
  77.     colors[1] = int(random(255));
  78.     colors[2] = int(random(255));
  79.     m_velocity = int(random(5));
  80.     while (m_velocity == 0) {
  81.       m_velocity = int(random(5));
  82.     }
  83.   }
  84.   else {
  85.     BarX[0] += m_velocity;
  86.   }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement