Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*------------------------------------------
- Parachute remake for Makebuino
- v0.1 by Jicehel Date:05/08/017
- Based on Nintendo Game & Watch Paachute
- Thanks to Luis Dominguez - LADBSoft.com
- for the examples with “Firebuino”
- ------------------------------------------*/
- #include <Gamebuino.h>
- #include <EEPROM.h>
- #include <SPI.h>
- Gamebuino gb;
- long score;
- long highscore;
- short misses;
- short BoatPosition;
- short moveTick;
- short spawnDelay;
- short noParachutes;
- short randNo;
- short shark_anim;
- byte gameState;
- short x;
- const byte barque_p1[] PROGMEM = { 8,7,
- B00111000,B01011100,B01111000,B00110000,B11011100,B11111111,B11001111,};
- const byte barque_p2[] PROGMEM = { 8,7,
- B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11111110,};
- const byte requin_p1[] PROGMEM = { 8,6,
- B00000000,B11000001,B11110110,B11111111,B01111110,B11111111,B00000000,B00000000,};
- const byte requin_p2[] PROGMEM = { 5,6,
- B00111000,B11111000,B11010000,B10000000,B00110000,B11110000,};
- const byte aileron[] PROGMEM =
- {
- 8,8,
- B00010000,
- B01110000,
- B01110000,
- B11110000,
- B00000000,
- B00000000,
- B00000000,
- B00000000,
- };
- const byte subBackgroundBitmap[] PROGMEM = {88,48,
- B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00010000,
- B11101001,B10001000,B10110101,B01111011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
- B10110101,B01010101,B01110101,B01010010,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
- B11011101,B10011101,B00111101,B01010011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
- B10010101,B01010101,B01110101,B01010010,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
- B10010101,B01010100,B10110101,B11010011,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
- B00000000,B00000000,B00100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
- B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
- B00011010,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
- B01101110,B10100111,B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
- B11111111,B11111111,B11111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
- B11111111,B11111111,B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
- B01111111,B11111101,B01110100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
- B11111111,B01001000,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000100,B10110000,
- B10011100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11001101,B10110000,
- B00011000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011110,B11111111,B11110000,
- B00111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01111111,B11111111,B11110000,
- B00110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111111,B11111111,B11110000,
- B01110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000010,B01111111,B01111111,B11100000,
- B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B01000100,B11111011,B10110000,
- B01100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11111001,B11000000,
- B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B10101000,B11000000,
- B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00100000,B11100000,
- B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11110000,
- B11100000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11110000,
- B11110000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11110000,
- B11111110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00011111,B11110000,
- B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00111111,B11110000,
- B11111111,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11110000,
- B11111111,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11110000,
- B11111110,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11111111,B11110000,
- B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000111,B11110000,
- B11111100,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11110000,
- B11111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11110000,
- B11111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11110000,
- B11111000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B11110000,
- B11111000,B00000000,B00000000,B00000000,B00000000,B00111000,B00000000,B00000000,B00000000,B00000000,B01110000,
- B11110000,B11110011,B00011110,B01100001,B11111001,B11111100,B11001111,B11100000,B00010000,B00100000,B11110000,
- B00000000,B00000100,B00000000,B00000000,B00000000,B01000000,B00000000,B00110000,B00000000,B00000000,B00000000,
- B11100000,B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,
- B00001110,B00000000,B00000000,B00000000,B00000000,B00001000,B00000000,B00000011,B11110001,B11000011,B11100000,
- B11110001,B11100000,B00000000,B00000000,B00000000,B00001000,B00000000,B00000000,B00001111,B00111111,B00000000,
- B00001110,B00000000,B00000000,B01111100,B00001111,B00111110,B00000000,B00000000,B00000000,B11000000,B00000000,
- B11000000,B01111100,B00000000,B00000000,B00000000,B00001000,B00000000,B00000000,B00000000,B00000001,B11110000,
- B00000000,B00000000,B00000000,B00000000,B00000000,B00001000,B00000000,B00000000,B00000000,B00000000,B00000000,
- B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,
- B00000000,B00000001,B11111001,B11100001,B11110011,B11000111,B11111100,B00001111,B10000000,B00000000,B00000000,
- B10000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00010000,};
- void titleScreen() {
- // gb.titleScreen(F(“Parachute”), titleScreenBitmap);
- gb.titleScreen(F("Parachute"));
- gb.battery.show = false;
- }
- void initGame() {
- gb.pickRandomSeed();
- misses = 0;
- score = 0;
- BoatPosition = 1;
- spawnDelay = 2;
- shark_anim = 0;
- moveTick = 30;
- }
- void setup() {
- gb.begin();
- initGame();
- }
- void drawBackground() {
- //Draw gray background
- gb.display.setColor(GRAY, WHITE);
- gb.display.drawBitmap(0, 0, subBackgroundBitmap);
- gb.display.setColor(BLACK, WHITE);
- }
- void anim_shark() {
- if (shark_anim == 1) gb.display.drawBitmap(40 , 38, aileron);
- if (shark_anim == 2) gb.display.drawBitmap(22 , 38, aileron);
- if (shark_anim == 3) gb.display.drawBitmap(13 , 42, aileron,0,FLIPH);
- if (shark_anim == 4) gb.display.drawBitmap(29 , 42, aileron,0,FLIPH);
- if (shark_anim == 5) {
- gb.display.drawBitmap(48 , 40, requin_p1);
- gb.display.drawBitmap(56 , 40, requin_p2);
- // Traiter la fin de l’animation du requin
- shark_anim = 0;
- }
- }
- void loop() {
- while (1) {
- if (gb.update()) {
- gb.display.clear();
- drawBackground();
- if(gb.buttons.pressed(BTN_LEFT) || gb.buttons.pressed(BTN_A) ){
- if (BoatPosition > 1) BoatPosition--;
- }
- if(gb.buttons.pressed(BTN_RIGHT) || gb.buttons.pressed(BTN_B) ){
- if (BoatPosition < 3) BoatPosition++;
- }
- x = BoatPosition * 16 - 8;
- gb.display.drawBitmap(x , 30, barque_p1);
- gb.display.drawBitmap(x+8 , 30, barque_p2);
- anim_shark();
- if (moveTick > 0) {
- moveTick --;
- }
- else {
- // if ((shark_anim > 0) || ((shark_anim = 0) && (random(50) < 20))) {
- shark_anim++;
- // }
- moveTick = 30;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement