SHARE
TWEET

Untitled

Jicehel Sep 18th, 2017 124 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. /*------------------------------------------
  3. Parachute remake for Makebuino
  4. v0.3 by Jicehel Date:05/08/017
  5. Based on Nintendo Game & Watch Parachute
  6. Thanks to Luis Dominguez - LADBSoft.com
  7. for the examples with “Firebuino”
  8. --------------------------------------------
  9. Last changes:
  10. - Add full graphics
  11. - Add Helico animation
  12. - Add Paratroopers animation
  13. - Add Misses and swimmer animation
  14. - Add score
  15. --------------------------------------------
  16. To do:
  17. - Change and adjust speed quickest when the score growth            
  18. ------------------------------------------*/
  19. #include <Gamebuino.h>
  20. #include <EEPROM.h>
  21. #include <SPI.h>
  22. Gamebuino gb;
  23.  
  24. int  score;
  25. long  highscore;
  26. short misses;
  27. short manage_joystick;
  28. short BoatPosition;
  29. short moveTick;
  30. short spawnDelay;
  31. short spawnCount;
  32. short Nb_Parachutes_launched;
  33. short Position_Parachute[10];
  34. short Colonne_Para;
  35. short Position_Para;
  36. short shark_anim;
  37. short helico_anim;
  38. short vitesse_pales;
  39. byte  gameState;
  40. byte  speedmax;
  41. short x;
  42. int temp;
  43.  
  44. //  const int JoyY_pin = A5; // Analog pin connected to joystick's Y axis output (not used in parachute)
  45. const int JoyX_pin = A4;   // Analog pin connected to joystick's X axis output
  46. int JoyX_pos = 0; // Variable to store position of joystick's Y axis
  47.  
  48. const byte barque[] PROGMEM = { 16,7,
  49. B00111000,B00000000,B01011100,B00000000,B01111000,B00000000,B00110000,B00000000,B11011100,B00000000,B11111111,B11111111,B11001111,B11111110,};
  50.  
  51. const byte requin_m[] PROGMEM = { 16,6,
  52. B00000000,B00111000,B11000001,B11111000,B11110110,B11010000,B11111111,B10000000,B01111110,B00110000,B11111111,B11110000,};
  53.  
  54. const byte aileron[] PROGMEM = { 8,8,
  55. B00010000,B01110000,B01110000,B11110000,B00000000,B00000000,B00000000,B00000000,};
  56.  
  57. const byte titleScreenBitmap[] PROGMEM = {80,32,
  58. 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,0x0,0x0,0x0,0x0,0xFF,0xFF,0xFF,0xFF,0xFF,0xC0,0x0,0x0,0x0,
  59. 0x1,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0x0,0x0,0x0,0x3,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0x0,0x0,0x0,0x3,0xE0,0x0,0x0,0x1,0xFF,0xF0,0x0,0x0,0x0,0x3,0xE0,0x0,0x4F,0x9,0xFD,0xF0,0x0,0x0,0x0,
  60. 0x3,0xE0,0x0,0x3F,0x80,0xAB,0xF0,0x0,0x0,0x0,0x3,0xE1,0xE0,0xE7,0xC2,0xFF,0xF0,0x0,0x0,0x0,0x3,0xFF,0xF1,0xFF,0xE1,0x29,0xF0,0x0,0x0,0x0,0x3,0xFF,0x81,0x89,0xE3,0xFD,0xF0,0x0,0x0,0x0,
  61. 0x3,0xFF,0x81,0xC9,0xE1,0xFF,0xF0,0x0,0x0,0x0,0x3,0xFF,0x81,0x4E,0x20,0xF9,0xF0,0x0,0x0,0x0,0x3,0xF6,0xE0,0x36,0x50,0x67,0xF0,0x0,0x0,0x0,0x3,0xF0,0x0,0x1F,0xA0,0x27,0xF0,0x0,0x0,0x0,
  62. 0x3,0xFC,0x0,0x7D,0x0,0xF,0xF0,0x0,0x0,0x0,0x3,0xFC,0x0,0x37,0x0,0x1F,0xF0,0x0,0x0,0x0,0x3,0xF8,0x7B,0x22,0x1,0xFF,0xF0,0x0,0x0,0x0,0x3,0xF8,0x3,0xF0,0x0,0x7,0xF0,0x0,0x0,0x0,
  63. 0x3,0xFF,0x80,0x80,0x0,0x7,0xF0,0x0,0x0,0x0,0x3,0xF8,0x0,0x0,0x19,0x87,0xF0,0x0,0x0,0x0,0x3,0xE0,0x0,0x1,0xF2,0x87,0xF0,0x0,0x0,0x0,0x3,0xF0,0x72,0x80,0x78,0x1,0xF0,0x0,0x0,0x0,
  64. 0x3,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0x0,0x0,0x0,0x3,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0x0,0x0,0x0,0x1,0xFF,0xFF,0xFF,0xFF,0xFF,0xE0,0x0,0x0,0x0,0x0,0xFF,0xFF,0xFF,0xFF,0xFF,0xC0,0x0,0x0,0x0,
  65. 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
  66.  
  67. const byte Helice[] PROGMEM = {8,1,B11111000,};
  68.  
  69. const byte Helico[] PROGMEM = {24,10,
  70. B00000100,B00000000,B00000000,B00000100,B00000100,B00000000,B00001110,B00000100,B00000000,B00011111,B00011111,
  71. B00000000,B00011111,B11111001,B10000000,B00011110,B10101000,B11000000,B00001110,B10101111,B11000000,B00000111,
  72. B11111111,B10000000,B00000011,B00000110,B00000000,B00000011,B00000110,B00000000,};
  73.  
  74. const byte Noye_1[] PROGMEM = {16,5,B01000100,B01000000,B00001110,B00000000,B10101010,B10000000,B00011111,B00000000,B00001110,B00000000,};
  75.  
  76. const byte Noye_2[] PROGMEM = {16,5,B00000000,B01000000,B01001110,B00000000,B00001101,B01000000,B00111111,B00000000,B00001110,B00000000,};
  77.  
  78. const byte Para_1[] PROGMEM = {8,8,B00000100,B00100111,B00110011,B10011111,B11011100,B01111111,B00110010,B01100000,};
  79.  
  80. const byte Nageur[] PROGMEM = {8,5,B01000000,B11101110,B11111111,B00011110,B01111100,};
  81.  
  82. const byte Parra_m[] PROGMEM = {8,5,B00001100,B10110110,B10000110,B11111100,B00111100,};
  83.  
  84. const byte Para_2[] PROGMEM = {16,11,
  85. B00000000,B00011000,B00000000,B00111000,B00011100,B01110000,B00111100,B11100000,B10011101,B11000000,B01101111,
  86. B00000000,B00011110,B00000000,B01111111,B00000000,B11011001,B10000000,B00110000,B00000000,B01100000,B00000000,};
  87.  
  88. const byte Para_3[] PROGMEM = {16,15,
  89. B00000001,B10000000,B00000011,B10000000,B00000111,B10000000,B00001101,B00000000,B00011011,B00000000,B00011110,
  90. B00000000,B00000100,B00000000,B00111000,B00000000,B00111100,B00000000,B00111000,B00000000,B10011011,B00000000,
  91. B01111100,B00000000,B00110000,B00000000,B01010000,B00000000,B11011000,B00000000,};
  92.  
  93. const byte Para_4[] PROGMEM = {16,17,
  94. B00001111,B11100000,B00111011,B11111000,B01110011,B11011100,B11100111,B11001110,B11111111,B11001110,B11100100,
  95. B11111110,B10000100,B01001110,B01000100,B01000010,B00100100,B11000100,B00010111,B11001000,B00001101,B11010000,
  96. B00000111,B11100000,B00000001,B10010000,B00000001,B11110000,B00011011,B10000000,B00001100,B11100000,B00000000,B00110000,};
  97.  
  98. const byte Para_5[] PROGMEM = {24,18,
  99. B00000011,B11100000,B00000000,B00011111,B11111000,B00000000,B00111001,B11111110,B00000000,B01110001,B11111111,
  100. B00000000,B01110011,B11111011,B10000000,B11111111,B11111001,B10000000,B11000111,B01111001,B11000000,B10000010,
  101. B00011111,B11000000,B01000010,B00001011,B11000000,B00100011,B00001000,B11000000,B00010111,B10010000,B01000000,
  102. B00001011,B10010001,B10000000,B00100101,B10111110,B00000000,B00110111,B01100000,B00000000,B00011111,B11100000,
  103. B00000000,B00100011,B00000000,B00000000,B00111111,B11110000,B00000000,B00110000,B01100000,B00000000,};
  104.  
  105. const byte Miss[] PROGMEM = {8,5,B11000000,B11100100,B11111100,B01111100,B11001100,};
  106.  
  107. #define NUM_SPRITES 6
  108. const byte* shark[NUM_SPRITES] = {
  109.   aileron, //0
  110.   aileron, //1
  111.   aileron, //2
  112.   aileron, //3
  113.   aileron, //4
  114.   requin_m //5
  115. };
  116.  
  117. const byte subBackgroundBitmap[] PROGMEM = {88,48,
  118. B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00010000,
  119. B11101001,B10001000,B10110101,B01111011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  120. B10110101,B01010101,B01110101,B01010010,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  121. B11011101,B10011101,B00111101,B01010011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  122. B10010101,B01010101,B01110101,B01010010,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  123. B10010101,B01010100,B10110101,B11010011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  124. B00000000,B00000000,B00100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  125. B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  126. B00011010,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  127. B01101110,B10100111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  128. B11111111,B11111111,B11111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  129. B11111111,B11111111,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  130. B01111111,B11111101,B01110100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  131. B11111111,B01001000,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000100,B10110000,
  132. B10011100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11001101,B10110000,
  133. B00011000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011110,B11111111,B11110000,
  134. B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,B11111111,B11110000,
  135. B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,B11111111,B11110000,
  136. B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000010,B01111111,B01111111,B11100000,
  137. B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01000100,B11111011,B10110000,
  138. B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111001,B11000000,
  139. B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B10101000,B11000000,
  140. B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11100000,
  141. B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11110000,
  142. B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11110000,
  143. B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11110000,
  144. B11111110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,B11110000,
  145. B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11110000,
  146. B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11110000,
  147. B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11110000,
  148. B11111110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11110000,
  149. B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11110000,
  150. B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11110000,
  151. B11111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11110000,
  152. B11111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11110000,
  153. B11111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11110000,
  154. B11111000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B00000000,B00000000,B00000000,B01110000,
  155. B11110000,B11110011,B00011110,B01100001,B11111001,B11111100,B11001111,B11100000,B00010000,B00100000,B11110000,
  156. B00000000,B00000100,B00000000,B00000000,B00000000,B01000000,B00000000,B00110000,B00000000,B00000000,B00000000,
  157. B11100000,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
  158. B00001110,B00000000,B00000000,B00000000,B00000000,B00001000,B00000000,B00000011,B11110001,B11000011,B11100000,
  159. B11110001,B11100000,B00000000,B00000000,B00000000,B00001000,B00000000,B00000000,B00001111,B00111111,B00000000,
  160. B00001110,B00000000,B00000000,B01111100,B00001111,B00111110,B00000000,B00000000,B00000000,B11000000,B00000000,
  161. B11000000,B01111100,B00000000,B00000000,B00000000,B00001000,B00000000,B00000000,B00000000,B00000001,B11110000,
  162. B00000000,B00000000,B00000000,B00000000,B00000000,B00001000,B00000000,B00000000,B00000000,B00000000,B00000000,
  163. B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,
  164. B00000000,B00000001,B11111001,B11100001,B11110011,B11000111,B11111100,B00001111,B10000000,B00000000,B00000000,
  165. B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00010000,};
  166.  
  167.  
  168. void initGame() {
  169.   gb.pickRandomSeed();
  170.   misses = 0;
  171.   score = 0;
  172.   BoatPosition = 1;
  173.   spawnDelay = 4; // Délai avant autorisation d'envoi de parachute
  174.   shark_anim = 0;
  175.   speedmax = 25;   // Nombre de cycles avant mise à jour de la boucle
  176.   helico_anim = 0;
  177.   vitesse_pales = 5;
  178.   moveTick = speedmax;
  179.   spawnCount = spawnDelay;
  180.   manage_joystick = 0;    
  181. }
  182.  
  183. void setup() {
  184.   gb.begin();
  185.   initGame();
  186.   //  gb.display.setFont(font5x7); //change the font to the large one
  187.   gb.titleScreen(F("Parachute"), titleScreenBitmap);
  188.   gb.pickRandomSeed(); //pick a different random seed each time for games to be different
  189.   gb.battery.show = false;
  190.  
  191.   //############################################################
  192.   //  pinMode(JoyY_pin, INPUT); //Configures pin on microcontroller
  193.   pinMode(JoyX_pin, INPUT);
  194.   //############################################################
  195.  
  196.   initGame();
  197. }
  198.  
  199. void anim_shark() {
  200.   switch (shark_anim) {
  201.       case 0 :
  202.         break;
  203.       case 1 :
  204.         gb.display.drawBitmap(62 , 38, shark[shark_anim - 1]);
  205.         break;  
  206.       case 2 :
  207.         gb.display.drawBitmap(46 , 38, shark[shark_anim - 1]);
  208.         break;
  209.       case 3 :
  210.         gb.display.drawBitmap(32 , 38, shark[shark_anim - 1]);
  211.         break;
  212.       case 4 :
  213.         gb.display.drawBitmap(5 , 42, shark[shark_anim - 1],0,FLIPH);
  214.         break;
  215.       case 5 :
  216.         gb.display.drawBitmap(24 , 42, shark[shark_anim - 1],0,FLIPH);
  217.         break;
  218.       case 6 :
  219.         gb.display.drawBitmap(48 , 40, shark[shark_anim - 1]);
  220.         break;
  221.       case 7:
  222.         // Traiter la fin de l’animation du requin
  223.         shark_anim = 0;
  224.         break;
  225.   }
  226.     if (moveTick <= 0)
  227.       if ((shark_anim > 0) || ((shark_anim == 0) && (random(50) < 5))){
  228.          shark_anim++;
  229.          // gb.sound.playTick();
  230.       }
  231. }
  232.  
  233. void anim_helico() {
  234.   vitesse_pales--;
  235.   if (vitesse_pales == 0) {
  236.    switch(helico_anim) {
  237.      case 0:
  238.         gb.display.drawBitmap(65 , 0, Helice);
  239.         gb.display.drawBitmap(71 , 0, Helice);
  240.         break;
  241.       case 1 :
  242.         gb.display.drawBitmap(65 , 0, Helice);
  243.         gb.display.drawBitmap(71 , 0, Helice);
  244.         gb.display.drawBitmap(73 , 1, Helice);
  245.         gb.display.drawBitmap(79 , 1, Helice);
  246.         break;
  247.       case 2 :
  248.         gb.display.drawBitmap(73 , 1, Helice);
  249.         gb.display.drawBitmap(79 , 1, Helice);
  250.         break;
  251.       case 3 :
  252.         helico_anim = 0;
  253.         break;
  254.   }
  255.   helico_anim++;  
  256.   vitesse_pales = 5;
  257.   }
  258. }
  259.  
  260. void anim_para() {
  261.   int   compteur;
  262.   for (compteur = 1 ; compteur <= Nb_Parachutes_launched ; compteur++)  {
  263.           Colonne_Para = Position_Parachute[compteur] / 10;
  264.           Position_Para = Position_Parachute[compteur] - Colonne_Para*10;
  265.           Dessine_Para(Colonne_Para,Position_Para, compteur);
  266.           if (moveTick==0) {
  267.           if ((Position_Para >= 4+Colonne_Para) && (Colonne_Para <=3) ) Test_Barque(Colonne_Para,compteur);
  268.           else Position_Parachute[compteur]++ ;
  269.           }
  270.     }  
  271. }
  272.  
  273. void Dessine_Para(short ColX, short PosY, short Parachute) {
  274.   int count;
  275.   // Dessine le para en fonction de sa colonne (1 à gauche et 3 à droite) et de sa position
  276.   if (ColX < 4) {
  277.     switch(PosY) {
  278.       case 1:
  279.         gb.display.drawBitmap(72 - 6*ColX  , 9 - 3*ColX, Para_1);
  280.         break;
  281.       case 2:
  282.         gb.display.drawBitmap(67 - 7*ColX  , 11 - 3*ColX, Para_2);
  283.         break;
  284.       case 3:
  285.         gb.display.drawBitmap(56 - 6*ColX  , 14 - 5*ColX, Para_3);
  286.         break;
  287.       case 4:
  288.         gb.display.drawBitmap(54 - 8*ColX  , 15 - (ColX-1)*4, Para_4);
  289.         break;
  290.       case 5:
  291.         gb.display.drawBitmap(62 - 16*ColX  , 12 + (3 - ColX)*3, Para_5);
  292.         break;
  293.       case 6:
  294.         if (ColX==2) gb.display.drawBitmap(29 , 17, Para_5);
  295.         else gb.display.drawBitmap(16 , 1é, Para_5) ;
  296.         break;
  297.       case 7:
  298.         gb.display.drawBitmap(13 , 17, Para_5);
  299.         break;
  300.       case 8:
  301.         break;
  302.     }
  303.   } else {
  304.     switch(PosY) {
  305.       case 1:
  306.         gb.display.drawBitmap(48 , 39, Noye_1);
  307.         break;
  308.       case 2:
  309.         gb.display.drawBitmap(30 , 39, Noye_2);
  310.         break;
  311.       case 3:
  312.         gb.display.drawBitmap(14, 39, Noye_2,0,FLIPH);
  313.         break;
  314.       case 4:
  315.         gb.display.drawBitmap(21, 43, Nageur);
  316.         break;
  317.       case 5:
  318.         gb.display.drawBitmap(37, 43, Nageur);
  319.         break;
  320.       case 6:
  321.         gb.display.drawBitmap(62, 43, Parra_m);
  322.         break;
  323.       case 7:
  324.         for (count = Parachute; count < Nb_Parachutes_launched ; count++) {
  325.           Position_Parachute[count] = Position_Parachute[count+1];
  326.         }
  327.         Nb_Parachutes_launched-- ;
  328.         break;
  329.     }
  330.   }
  331. }
  332.  
  333. void Test_Barque(int colonne, int para_courant) {
  334. int count;
  335. // Test si la barque est sous le para => score ou passe le para en mode nageur (colonne théorique: 4) ...
  336.   if (colonne == 4 - BoatPosition ) {
  337.     score ++;
  338.     for (count = para_courant; count < Nb_Parachutes_launched ; count++) {
  339.        Position_Parachute[count] = Position_Parachute[count+1];
  340.     }
  341.     Nb_Parachutes_launched --;
  342.   } else {
  343.      misses++;
  344.      Position_Parachute[para_courant] = 4*10 + colonne;  
  345.      shark_anim = colonne;
  346.      moveTick = 0;
  347.      if (Nb_Parachutes_launched > 1) {
  348.        for (count = 2; count <= Nb_Parachutes_launched ; count++) Position_Parachute[count] = 0;
  349.        Nb_Parachutes_launched == 1;
  350.      }
  351.      spawnCount = spawnDelay;
  352.   }
  353. }
  354.  
  355. void loop() {
  356.   if (gb.update()) {
  357.     // Gestion du Joystick                              // Comments
  358.     if(analogRead(JoyX_pin) <= 600)       JoyX_pos = 1; // Joystick is in left position
  359.     else if(analogRead(JoyX_pin)>= 700)   JoyX_pos = 2; // Joystick is in right position
  360.          else JoyX_pos = 0;                            // Joystick is inside dead spot at or near its home positon
  361.  
  362.     //pause the game if C is pressed
  363.     if(gb.buttons.pressed(BTN_C)){
  364.      gb.titleScreen(F("Parachute"), titleScreenBitmap);
  365.       gb.battery.show = false;
  366.       // gb.display.fontSize = 2;
  367.     }
  368.  
  369.     gb.display.drawBitmap(0, 0, subBackgroundBitmap);
  370.    
  371.     // Animation de la barque
  372.     if(gb.buttons.pressed(BTN_LEFT) || gb.buttons.pressed(BTN_A) || (JoyX_pos == 1 && manage_joystick== 1)){
  373.         if (BoatPosition > 1) BoatPosition--;
  374.     }
  375.     if(gb.buttons.pressed(BTN_RIGHT) || gb.buttons.pressed(BTN_B) || (JoyX_pos == 2 && manage_joystick== 1)){
  376.         if (BoatPosition < 3) BoatPosition++;
  377.     }
  378.     if (BoatPosition < 1) BoatPosition = 1;
  379.     if (BoatPosition > 3) BoatPosition = 3;
  380.     gb.display.drawBitmap(BoatPosition * 16 - 8 , 30, barque);
  381.  
  382.     if (moveTick > 0) moveTick --;
  383.     else {
  384.           spawnCount--;
  385.     if ((spawnCount < 1) && (random(6 - (score / 200))< 2)) {
  386.       temp = int(random(3))+1;
  387.       Nb_Parachutes_launched++;
  388.       Position_Parachute[Nb_Parachutes_launched] = temp*10+1;
  389.       spawnCount = spawnDelay - int(score / 100);
  390.     }
  391.        moveTick = speedmax - (score / 100);
  392.     }
  393.     gb.display.drawBitmap(65 , 0, Helico);
  394.  
  395.     anim_shark();  // Animation du requin
  396.     anim_para();   // Animation du parachutiste
  397.     anim_helico(); // Animtion de l'hélicoptère
  398.     gb.display.setColor(BLACK,WHITE);
  399.     gb.display.cursorX = 0;
  400.     gb.display.cursorY = 0;
  401.     gb.display.print("Score :    ");
  402.     gb.display.cursorX = 30;
  403.     gb.display.println(score);
  404.     // Suit une variable pour debuggage
  405.     // gb.display.print("         ");
  406.     // gb.display.cursorX = 30;
  407.     // gb.display.println(Nb_Parachutes_launched);
  408.   }  
  409. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top