Guest User

Untitled

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