Parachute - A creation from the start

I’ll try to create a conversion of Parachute.
Parachute est un jeu électronique à cristaux liquides Game and Watch. Il est sorti le 19 juin 1981 en version Wide Screen
Parachute is a LCD electronical game and watch commercialized from 19th june 1981 with a Wild Screen version

You’ll see below the graphical picture from witch i’ll start to developp the game
Parachute

3 Likes

First step, make a correct version at the good resolution (84 px x 48 px)
This step as just been done i think.
Parachute_84

Next step will be to the separate pictures and to load them.
I’ll download the background and the boat to move it when i push A or left / B or right.

I’ll begin easy just to control that i have understood how to make it as @luke27 (the creator of Firebuino) has explain.

Now it’s time for me to go out but. When I’ll have some minutes to do it and if it’s works, i’ll post the first hex with this first step.

2 Likes

Loving it already! Can’t wait to see it working :slight_smile:

1 Like

@luke27, Luke, i don’t understand how to use a background image and load it. I have make some tries.
I successfully move the boat (it’s easy) but i don’t understand how to load the backgroung picture.
Maybe i have to encode it but i don’t see encoded picture in your program, so i think it’s should be possible to diectly load a picture. I’m wrong ? If its possible can you explain me how to do it ?

Else, i have make the inf for parachute:
http://www.k-upload.fr/afficher-fichier-2017-08-06-1207c5d09parachut.inf.html

@luke27 Hum, i have used the method i konw with encoded picture, the boat can be controlled but now i try to understand how to animate something. I have take a shark. My shark(s) stay shown but i would make them move to simulate when they are swimming to catch the paratrooper.

This is the test code in state:

/------------------------------------------
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 = 300;
}

void setup() {
gb.begin();
initGame();
}
void drawBackground() {
//Draw gray background
gb.display.setColor(GRAY, WHITE);
gb.display.drawBitmap(0, 0, subBackgroundBitmap);
}

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 = 300; 
    }
  }   
}   

}

Do you understand and know how i can fix the animation of the shark ? If i understand it, i’ll be able to do same fo the paratroopers.

I write at luke27 because he have make a game in the spirit of the one i want make but of course anybody able to understand how to program and how it’s works to obtain what we want is welcome to explain me :wink:

I have just some little things to understand with the logical of how to use the screen to continue.

Hey @Jean-Charles_Lebeau!

You were pretty close! :slight_smile:

When checking if a variable is equal to something, the equals sign must be doubled:

if (shark_anim == 1)

A single equals sign is only used to assign a value.

A couple more things:

  • When drawing, the color would be the last used with gb.display.color(), so if you set it to gray drawing the background and don’t reset it to black afterwards, the boat and everything else will be also drawn in gray :slight_smile:
  • Note that “moveTick” is being loaded with 300. That is equals to 15 seconds, so every game step will last that.

I fixed those bits. Take a look:

https://pastebin.com/25CB4Lch

Tip: the last animation step lasts only a little bit because as soon as it is drawn the first time, it is reset to the first step :wink:

2 Likes

Thanks @luke27, yes i was very close but i was not looking for this sot of error so many thanks to have find it… I was thinking to all but this… :slight_smile:

I’ll be able to continue with this. I have remobe the change of color, because i don’t know how do for let it works. For me it’s always black. So if change og color don’t change my draws, it’s better to simplify program. At the moment, this program is:

/*------------------------------------------
Parachute remake for Makebuino
v0.2 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 int JoyY_pin = A5; // Analog pin connected to joystick's Y axis output (not used in parachute)
const int JoyX_pin = A4;   // Analog pin connected to joystick's X axis output
int JoyX_pos = 0; // Variable to store position of joystick's Y axis

const byte barque[] PROGMEM = { 16,7,
B00111000,B00000000,B01011100,B00000000,B01111000,B00000000,B00110000,B00000000,B11011100,B00000000,B11111111,B11111111,B11001111,B11111110,};

const byte requin_m[] PROGMEM = { 16,6,
B00000000,B00111000,B11000001,B11111000,B11110110,B11010000,B11111111,B10000000,B01111110,B00110000,B11111111,B11110000,};

const byte aileron[] PROGMEM = { 8,8,
B00010000,B01110000,B01110000,B11110000,B00000000,B00000000,B00000000,B00000000,};

const byte titleScreenBitmap[] PROGMEM = {88,48,
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11110000,
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11110000,
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11110000,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000001,B11110000,B00110000,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000010,B00010000,B00110000,
B11000100,B00011000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00010011,B11110000,B00110000,
B11000011,B11111000,B00001111,B11111111,B11111111,B11011111,B01111111,B11111111,B10010001,B11110010,B00110000,
B11010000,B10000000,B00010000,B00000000,B00000000,B00000000,B00000000,B00000000,B00010011,B11110000,B00110000,
B11010000,B11000000,B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B01010001,B11100010,B00110000,
B11000000,B11000000,B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11010011,B00010111,B10110000,
B11000111,B11011000,B00011110,B00000000,B00000000,B00000000,B00000000,B00000011,B11010011,B00010000,B00110000,
B11000011,B11111000,B00011110,B00000010,B00000010,B00001000,B00100001,B00000011,B11010011,B11110000,B00110000,
B11000000,B00000000,B00011110,B00000010,B00000000,B00011000,B01000011,B10110011,B11010001,B11110011,B00110000,
B11000000,B00000000,B00011110,B00000000,B00000000,B00100001,B00001011,B11111011,B11010001,B11100011,B00110000,
B11001111,B11111000,B00011111,B00001000,B00000000,B00010011,B00011001,B11111011,B11010011,B11110000,B00110000,
B11000000,B00000000,B00011110,B11111111,B10000000,B00000000,B00000100,B00000011,B11010010,B00010011,B00110000,
B11000000,B00000000,B00011111,B11000000,B00011100,B00000110,B00001000,B00000011,B11010011,B11110000,B00110000,
B11000000,B00000000,B00011110,B00101000,B00010100,B00000000,B00001000,B00010011,B11010001,B11100000,B00110000,
B11000000,B00000000,B00011110,B11100000,B00001000,B00000000,B00000011,B11111011,B11010000,B11100000,B00110000,
B11000000,B00000000,B00011101,B01110000,B00001000,B00000001,B10000011,B01100011,B11010000,B00000000,B00110000,
B11000000,B00000000,B00011111,B11110000,B00000000,B00000011,B11000001,B01101011,B11010000,B00000000,B00110000,
B11000000,B00000000,B00011110,B00000110,B00000000,B00000000,B00000000,B00000011,B11010000,B00000000,B00110000,
B11000000,B00000000,B00011111,B00000000,B00000000,B00000000,B10000000,B10000111,B10010000,B00000000,B00110000,
B11000000,B00000000,B00011111,B11000000,B00000000,B00000000,B00000000,B00011111,B11010000,B00000000,B00110000,
B11000000,B00000000,B00011111,B11000000,B00000011,B11000000,B00000000,B00111111,B10010000,B00000000,B00110000,
B11000000,B00000000,B00011111,B11000000,B00010000,B01000000,B00000000,B01011111,B11010000,B00000000,B00110000,
B11000000,B00000000,B00011111,B10000000,B00111001,B00000000,B00000000,B00001111,B11010000,B00000000,B00110000,
B11000000,B00000000,B00011111,B10000000,B00011011,B00000000,B00000100,B10100011,B11010000,B00000000,B00110000,
B11000001,B11110000,B00011111,B10000000,B00011111,B10000000,B00000000,B00010111,B11010000,B11111000,B00110000,
B11000011,B11111000,B00011110,B00000000,B00000000,B00000000,B00000000,B00011111,B11010001,B11111100,B00110000,
B11000011,B01111100,B00011110,B10000000,B00000000,B00000000,B00000000,B00011011,B11010001,B11111110,B00110000,
B11000111,B11111100,B00011110,B00000000,B00000000,B00000000,B11101100,B00010011,B11010011,B11111110,B00110000,
B11000111,B11111100,B00011110,B00000000,B00000000,B00000111,B11000100,B00000011,B11010011,B11111110,B00110000,
B11000011,B11111100,B00011110,B00000010,B00000000,B00001111,B10011000,B11001011,B11010001,B11111110,B00110000,
B11000011,B11111000,B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11010001,B11111100,B00110000,
B11000001,B11111000,B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B01010000,B11111000,B00110000,
B11000000,B00000000,B00010111,B11111111,B11111111,B11111111,B11000000,B00000000,B00010000,B00000000,B00110000,
B11000011,B11111000,B00001111,B11111111,B11111111,B11111111,B11111111,B11111111,B10010001,B11110100,B00110000,
B11000111,B11111000,B00000000,B00000000,B00000111,B01010111,B00000000,B00000000,B00010000,B11100100,B00110000,
B11000000,B00000000,B00011111,B11111111,B11111111,B11111111,B11111111,B11111111,B11000000,B00000000,B00110000,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,
B11000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00000000,B00110000,
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11110000,
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11110000,
B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11111111,B11110000,
};

#define NUM_SPRITES 5
const byte* shark[NUM_SPRITES] = {
  aileron, //0
  aileron, //1
  aileron, //2
  aileron, //3
  requin_m //4
};

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 initGame() {
  gb.pickRandomSeed();
  misses = 0;
  score = 0;
  BoatPosition = 1;
  spawnDelay = 2;
  shark_anim = 0;
  moveTick = 15;
}

void setup() {
  gb.begin();
  //  gb.display.setFont(font5x7); //change the font to the large one
  gb.titleScreen(F(“Parachute”), titleScreenBitmap);
  gb.pickRandomSeed(); //pick a different random seed each time for games to be different
  gb.battery.show = false;

  //############################################################
  //  pinMode(JoyY_pin, INPUT); //Configures pin on microcontroller
  pinMode(JoyX_pin, INPUT);
  //############################################################

  initGame();
}

void anim_shark() {

  switch (shark_anim) {
      case 0 :
        break;
      case 1 :  
        gb.display.drawBitmap(40 , 38, shark[shark_anim - 1]);
        break;
      case 2 :
        gb.display.drawBitmap(22 , 38, shark[shark_anim - 1]);
        break;
      case 3 :
        gb.display.drawBitmap(13 , 42, shark[shark_anim - 1],0,FLIPH);
        break;
      case 4 :
        gb.display.drawBitmap(29 , 42, shark[shark_anim - 1],0,FLIPH);
        break;
      case 5 :
        gb.display.drawBitmap(48 , 40, shark[shark_anim - 1]);
        break;
      case 6:  
        // Traiter la fin de l’animation du requin
        shark_anim = 0;
        break;
  }
  gb.sound.playTick();
}

void loop() {

  // Gestion du Joystick
  if(analogRead(JoyX_pin) <= 600){
    JoyX_pos = 1; //Joystick is in left position
  }  else if(analogRead(JoyX_pin)>= 700){
    JoyX_pos = 2; //Joystick is in right position
  }
  else{
    JoyX_pos = 0; //Joystick is inside dead spot at or near its home positon
  }

 
  if (gb.update()) {

    //pause the game if C is pressed
    if(gb.buttons.pressed(BTN_C)){
      gb.titleScreen(F(“Parachute”), titleScreenBitmap);
      gb.battery.show = false;
      // gb.display.fontSize = 2;
    }

    gb.display.drawBitmap(0, 0, subBackgroundBitmap);
    
    if(gb.buttons.pressed(BTN_LEFT) || gb.buttons.pressed(BTN_A) || JoyX_pos == 1 ){
        if (BoatPosition > 1) BoatPosition--;
    }
    if(gb.buttons.pressed(BTN_RIGHT) || gb.buttons.pressed(BTN_B) || JoyX_pos == 2 ){
        if (BoatPosition < 3) BoatPosition++;
    }
    x = BoatPosition * 16 - 8;
    gb.display.drawBitmap(x , 30, barque);

    anim_shark();   
    if (moveTick > 0) {
      moveTick --;
    } else {
       if ((shark_anim > 0) || ((shark_anim == 0) && (random(50) < 5)))   shark_anim++;
       moveTick = 15; 
    }
  }   
}  

I’ll be able to continue now and ad the helico and the parachutes :wink: Next time game should be playable.
Joystick is managed but it has not alot interest for this type of game. Anyway it’s works.

1 Like

Point of advancement and bugs to corect… I have add paatroopers moves but i don’t understand why my boat moves to position 0 when i miss paratrropers… Any idea ? I will terminate game soon but first i have to corect this things. Any idea or idea to perfect the game at this state ? (atm, you don’t see score, misses or gameover…)

/*------------------------------------------
Parachute remake for Makebuino
v0.3 by Jicehel Date:05/08/017
Based on Nintendo Game & Watch Parachute
Thanks to Luis Dominguez - LADBSoft.com
for the examples with “> Firebuino”


Last changes:

  • Add full graphics
  • Add Helico animation
  • Add Paratroopers animation
  • Add Misses and swimmer animation
  • Add score

To do:

  • Change and adjust speed quickest when the score growth
    ------------------------------------------*/
    #include <Gamebuino.h>
    #include <EEPROM.h>
    #include <SPI.h>
    Gamebuino gb;

long score;
long highscore;
short misses;
short manage_joystick;
short BoatPosition;
short moveTick;
short spawnDelay;
short spawnCount;
short Nb_Parachutes_launched;
short Position_Parachute[10];
short Colonne_Para;
short Position_Para;
short shark_anim;
short helico_anim;
short vitesse_pales;
byte gameState;
byte speedmax;
int compteur;
short x;

// const int JoyY_pin = A5; // Analog pin connected to joystick’s Y axis output (not used in parachute)
const int JoyX_pin = A4; // Analog pin connected to joystick’s X axis output
int JoyX_pos = 0; // Variable to store position of joystick’s Y axis

const byte barque[] PROGMEM = { 16,7,
B00111000,B00000000,B01011100,B00000000,B01111000,B00000000,B00110000,B00000000,B11011100,B00000000,B11111111,B11111111,B11001111,B11111110,};

const byte requin_m[] PROGMEM = { 16,6,
B00000000,B00111000,B11000001,B11111000,B11110110,B11010000,B11111111,B10000000,B01111110,B00110000,B11111111,B11110000,};

const byte aileron[] PROGMEM = { 8,8,
B00010000,B01110000,B01110000,B11110000,B00000000,B00000000,B00000000,B00000000,};

const byte titleScreenBitmap[] PROGMEM = {80,32,
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,
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,
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,
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,
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,
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,
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,
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,};

const byte Helice[] PROGMEM = {8,1,B11111000,};

const byte Helico[] PROGMEM = {24,10,
B00000100,B00000000,B00000000,B00000100,B00000100,B00000000,B00001110,B00000100,B00000000,B00011111,B00011111,
B00000000,B00011111,B11111001,B10000000,B00011110,B10101000,B11000000,B00001110,B10101111,B11000000,B00000111,
B11111111,B10000000,B00000011,B00000110,B00000000,B00000011,B00000110,B00000000,};

const byte Noye_1[] PROGMEM = {16,5,B01000100,B01000000,B00001110,B00000000,B10101010,B10000000,B00011111,B00000000,B00001110,B00000000,};

const byte Noye_2[] PROGMEM = {16,5,B00000000,B01000000,B01001110,B00000000,B00001101,B01000000,B00111111,B00000000,B00001110,B00000000,};

const byte Para_1[] PROGMEM = {8,8,B00000100,B00100111,B00110011,B10011111,B11011100,B01111111,B00110010,B01100000,};

const byte Nageur[] PROGMEM = {8,5,B01000000,B11101110,B11111111,B00011110,B01111100,};

const byte Parra_m[] PROGMEM = {8,5,B00001100,B10110110,B10000110,B11111100,B00111100,};

const byte Para_2[] PROGMEM = {16,11,
B00000000,B00011000,B00000000,B00111000,B00011100,B01110000,B00111100,B11100000,B10011101,B11000000,B01101111,
B00000000,B00011110,B00000000,B01111111,B00000000,B11011001,B10000000,B00110000,B00000000,B01100000,B00000000,};

const byte Para_3[] PROGMEM = {16,15,
B00000001,B10000000,B00000011,B10000000,B00000111,B10000000,B00001101,B00000000,B00011011,B00000000,B00011110,
B00000000,B00000100,B00000000,B00111000,B00000000,B00111100,B00000000,B00111000,B00000000,B10011011,B00000000,
B01111100,B00000000,B00110000,B00000000,B01010000,B00000000,B11011000,B00000000,};

const byte Para_4[] PROGMEM = {16,17,
B00001111,B11100000,B00111011,B11111000,B01110011,B11011100,B11100111,B11001110,B11111111,B11001110,B11100100,
B11111110,B10000100,B01001110,B01000100,B01000010,B00100100,B11000100,B00010111,B11001000,B00001101,B11010000,
B00000111,B11100000,B00000001,B10010000,B00000001,B11110000,B00011011,B10000000,B00001100,B11100000,B00000000,B00110000,};

const byte Para_5[] PROGMEM = {24,18,
B00000011,B11100000,B00000000,B00011111,B11111000,B00000000,B00111001,B11111110,B00000000,B01110001,B11111111,
B00000000,B01110011,B11111011,B10000000,B11111111,B11111001,B10000000,B11000111,B01111001,B11000000,B10000010,
B00011111,B11000000,B01000010,B00001011,B11000000,B00100011,B00001000,B11000000,B00010111,B10010000,B01000000,
B00001011,B10010001,B10000000,B00100101,B10111110,B00000000,B00110111,B01100000,B00000000,B00011111,B11100000,
B00000000,B00100011,B00000000,B00000000,B00111111,B11110000,B00000000,B00110000,B01100000,B00000000,};

const byte Miss[] PROGMEM = {8,5,B11000000,B11100100,B11111100,B01111100,B11001100,};

#define NUM_SPRITES 5
const byte* shark[NUM_SPRITES] = {
aileron, //0
aileron, //1
aileron, //2
aileron, //3
requin_m //4
};

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 initGame() {
gb.pickRandomSeed();
misses = 0;
score = 0;
BoatPosition = 1;
spawnDelay = 45;
shark_anim = 0;
speedmax = 30;
helico_anim = 0;
vitesse_pales = 5;
moveTick = speedmax;
spawnCount = spawnDelay;
manage_joystick = 0;
}

void setup() {
gb.begin();
// gb.display.setFont(font5x7); //change the font to the large one
gb.titleScreen(F(“Parachute”), titleScreenBitmap);
gb.pickRandomSeed(); //pick a different random seed each time for games to be different
gb.battery.show = false;

//############################################################
// pinMode(JoyY_pin, INPUT); //Configures pin on microcontroller
pinMode(JoyX_pin, INPUT);
//############################################################

initGame();
}

void anim_shark() {

switch (shark_anim) {
case 0 :
break;
case 1 :
gb.display.drawBitmap(40 , 38, shark[shark_anim - 1]);
break;
case 2 :
gb.display.drawBitmap(22 , 38, shark[shark_anim - 1]);
break;
case 3 :
gb.display.drawBitmap(13 , 42, shark[shark_anim - 1],0,FLIPH);
break;
case 4 :
gb.display.drawBitmap(29 , 42, shark[shark_anim - 1],0,FLIPH);
break;
case 5 :
gb.display.drawBitmap(48 , 40, shark[shark_anim - 1]);
break;
case 6:
// Traiter la fin de l’animation du requin
shark_anim = 0;
break;
}
gb.sound.playTick();
}

void anim_helico() {
switch(helico_anim) {
case 0:
gb.display.drawBitmap(65 , 0, Helice);
gb.display.drawBitmap(71 , 0, Helice);
break;
case 1 :
gb.display.drawBitmap(65 , 0, Helice);
gb.display.drawBitmap(71 , 0, Helice);
gb.display.drawBitmap(73 , 1, Helice);
gb.display.drawBitmap(79 , 1, Helice);
break;
case 2 :
gb.display.drawBitmap(73 , 1, Helice);
gb.display.drawBitmap(79 , 1, Helice);
break;
case 3 :
helico_anim = 0;
break;
}
}

void anim_para() {

for (compteur = 0 ; compteur < Nb_Parachutes_launched ; compteur++)
{
if (compteur > 0) {
Colonne_Para = Position_Parachute[compteur] / 10;
Position_Para = Position_Parachute[compteur] - Colonne_Para*10;
Dessine_Para(Colonne_Para,Position_Para);
if ((Position_Para >= 4+Colonne_Para) && (Colonne_Para <=3) ) Test_Barque(Colonne_Para,compteur);
else if (moveTick==0) Position_Parachute[compteur]++ ;
}
}
}

void Dessine_Para(short X, short Y) {
// Dessine le para en fonction de sa colonne (1 à gauche et 3 à droite) et de sa position
if (X < 4) {
switch(Y) {
case 1:
gb.display.drawBitmap(72 - 6X , 9 - 3X, Para_1);
break;
case 2:
gb.display.drawBitmap(67 - 7X , 11 - 3X, Para_2);
break;
case 3:
gb.display.drawBitmap(56 - 6X , 14 - 5X, Para_3);
break;
case 4:
gb.display.drawBitmap(54 - 8*X , 15 - (X-1)4, Para_4);
break;
case 5:
gb.display.drawBitmap(56 - 12
X , 12 + (3 - X)*3, Para_5);
break;
case 6:
if (X==2) gb.display.drawBitmap(29 , 17, Para_5);
else gb.display.drawBitmap(17 , 14, Para_5) ;
break;
case 7:
gb.display.drawBitmap(13 , 17, Para_5);
break;
case 8:
break;
}
} else {
switch(Y) {
case 1:
gb.display.drawBitmap(48 , 39, Noye_1);
break;
case 2:
gb.display.drawBitmap(30 , 39, Noye_2);
break;
case 3:
gb.display.drawBitmap(14, 39, Noye_2,0,FLIPH);
break;
case 4:
gb.display.drawBitmap(21, 43, Nageur);
break;
case 5:
gb.display.drawBitmap(37, 43, Nageur);
break;
case 6:
gb.display.drawBitmap(37, 43, Parra_m);
break;
case 7:
Nb_Parachutes_launched --;
break;
}
}
}

void Test_Barque(int colonne, int para_courant) {
int X;
// Test si la barque est sous le para => score ou passe le para en mode nageur (colonne théorique: 4) …
if (colonne == BoatPosition ) {
score ++;
if (para_courant < Nb_Parachutes_launched) Position_Parachute[para_courant] = Position_Parachute[Nb_Parachutes_launched];
Nb_Parachutes_launched–;
} else {
misses++;
Position_Parachute[1] = 4*10 + colonne;
shark_anim = colonne;
for (X = 2; X < Nb_Parachutes_launched ; X++) Position_Parachute[X] = 0;
Nb_Parachutes_launched == 1;
spawnCount = spawnDelay;
}
}

void loop() {

// Gestion du Joystick // Comments
if(analogRead(JoyX_pin) <= 600) JoyX_pos = 1; // Joystick is in left position
else if(analogRead(JoyX_pin)>= 700) JoyX_pos = 2; // Joystick is in right position
else JoyX_pos = 0; // Joystick is inside dead spot at or near its home positon
if (gb.update()) {

//pause the game if C is pressed
if(gb.buttons.pressed(BTN_C)){
 gb.titleScreen(F("Parachute"), titleScreenBitmap);
  gb.battery.show = false;
  // gb.display.fontSize = 2;
}

gb.display.drawBitmap(0, 0, subBackgroundBitmap);

// Animtion de l'hélicoptère
gb.display.drawBitmap(65 , 0, Helico);
anim_helico;
vitesse_pales--;
if (vitesse_pales < 0) {
  helico_anim++;
  vitesse_pales = 5;
}

// Animation de la barque
if(gb.buttons.pressed(BTN_LEFT) || gb.buttons.pressed(BTN_A) || (JoyX_pos == 1 && manage_joystick== 1)){
    if (BoatPosition > 1) BoatPosition--;
}
if(gb.buttons.pressed(BTN_RIGHT) || gb.buttons.pressed(BTN_B) || (JoyX_pos == 2 && manage_joystick== 1)){
    if (BoatPosition < 3) BoatPosition++;
}
gb.display.drawBitmap(BoatPosition * 16 - 8 , 30, barque);

// Animtion des parachutistes
anim_para();
spawnCount--;
if ((spawnCount < 1) && (random(6)< 2)) {
  spawnCount = int(random(3))+1;
  Nb_Parachutes_launched++;
  Position_Parachute[Nb_Parachutes_launched] = spawnCount*10+1;
  spawnCount = spawnDelay; 
}

// Animation du requin

if (moveTick > 0) moveTick --;
else {
   if ((shark_anim > 0) || ((shark_anim == 0) && (random(50) < 5)))   shark_anim++;
   moveTick = speedmax;
}
anim_shark();

}
}

Nobody have any idea of my error(s) ?

I can’t get your code to work, it’s riddled with errors when dealing with the first switch statement in the ‘Dessine_Para’ function.

Arduino: 1.8.3 (Windows 10), Board: “Arduino/Genuino Uno”

C:\Users\Dale\Desktop\MAKERbuino\Test Sketches\parachute_debug\parachute_debug.ino: In function ‘void Dessine_Para(short int, short int)’:

parachute_debug:249: error: unable to find numeric literal operator ‘operator""X’

gb.display.drawBitmap(72 - 6X , 9 - 3X, Para_1);

                        ^

parachute_debug:249: error: unable to find numeric literal operator ‘operator""X’

gb.display.drawBitmap(72 - 6X , 9 - 3X, Para_1);

                                 ^

parachute_debug:252: error: unable to find numeric literal operator ‘operator""X’

gb.display.drawBitmap(67 - 7X , 11 - 3X, Para_2);

                        ^

parachute_debug:252: error: unable to find numeric literal operator ‘operator""X’

gb.display.drawBitmap(67 - 7X , 11 - 3X, Para_2);

                                  ^

parachute_debug:255: error: unable to find numeric literal operator ‘operator""X’

gb.display.drawBitmap(56 - 6X , 14 - 5X, Para_3);

                        ^

parachute_debug:255: error: unable to find numeric literal operator ‘operator""X’

gb.display.drawBitmap(56 - 6X , 14 - 5X, Para_3);

                                  ^

parachute_debug:258: error: expected ‘)’ before numeric constant

gb.display.drawBitmap(54 - 8*X , 15 - (X-1)4, Para_4);

                                        ^

parachute_debug:261: error: unable to find numeric literal operator ‘operator""X’

gb.display.drawBitmap(56 - 12X , 12 + (3 - X)*3, Para_5);

                        ^

exit status 1
unable to find numeric literal operator ‘operator""X’

I’m not entirely sure what’s gone wrong here as you’re using a math notation that I’m unfamiliar with (E.g. “56 - 6X”) and I believe the compiler thinks that ‘6X’ is a variable, but C doesn’t allow variables to begin with a number. I don’t know how to fix it as I don’t have the same level of understanding about what the function is supposed to do.

You’re also using a lot of local variables that have the same names (E.g. ‘X’ in Dessine_Para, and ‘X’ in Test_Barque). Because they’re local variables, I don’t think they’ll be conflicting with each other, but it’s good practice to give your variables meaningful names rather than ‘X’, ‘Y’, ‘i’, ‘j’, etc as it’ll be a lot easier for other people to read and understand your code.

If you could change the math in the switch function to use a slightly different math notation and possibly change the variable names to something more meaningful(and unique, I doubt they’re conflicting but I don’t like to use variables that have the same names) then I may be able to get the game running on my console and work out where your original error is.

Sory, but it’s not the real problem, it’s a change on the forum. I don’t know why but forum change 3*X into 3X(I think it’s a sort of mathematic correction)

I will correct it in the copied code to let you try and find my real error. I haven’t find a ‘code’ balise to have a no modified code, so i undestand why alot ae posting code as link :wink:

ouch i don’t know how to fix it… It’s a display problem. The code is good but it’s don’t display the * … I think i will have to change X by another variable name. Else, you can corect it in your copied source. Next time i’ll post as link as other do. I didn’t noticed these display problems. I’ll change the variables name in my code else as you said it’s could resolve conflicts.

This is the link with the names changed. The problem of the moving boat is always here sadly…
https://pastebin.com/raXdUjgB

Hmm, seems the problem of the boat moving by itself to position zero does not happen to me. Instead, the paratroopers seem to reset their position to the top before reaching the water or boat.

parachut

I’ll try to take a look more closely to the code this weekend, since I am not having a lot of free time right now… I’ll let you know if I find something! :slight_smile:

1 Like

thanks Luke. i think i make a mistake in the logical but i’m on holidays and can’t really search atm. Anyway this part should work fine as it’s the main part of the game before trying to adjust difficulty and the last parts of game. One thing will be to add a step in the move of the paratrooper to let it a little more long on the screen when he is in the boat, i think. Thanks for your look in the code. I’ll learn with my mistakes and will do less next time (i hope) and i hope that my learning can help some other beginners :wink:

1 Like

@Jean-Charles_Lebeau, congratulations on your progress!
I’ve just found this old post I never managed to answer and I must say that despite not being finished, Parachute is looking really neat :grinning: .

Did you make any progress on this? I might get enough time sometimes this week to take a look at your code

@albertgajsak Not yet, i have had no time to make some progress with the return to the school of my children, the begin of the activities asw… I’ll try to program a little this weekend and to correct the bugs and continue it.

I have worked a few on it and corected some big bugs: Now, it’s playable (not finish but playable)
You can find source here: : https://pastebin.com/cbsMrFrm

I’ll take all good idea to perfect this part of the code and the gameplay before adding the last things (missed count, end of game, 200 and 500 bonuses and trying to find a better adjustement of speed / launching paratroopers and let time to move to catch them).

Another little bad bug is the repeat display of a sprite after the deletation of another (paratrooper catched by boat)

So any advice, any solution to perfect or corect something is Welcome :wink:

Nobody have try ? No idea to perfect the timing to launch paratrooper or to corect the redraw of the paratrooper after another have been catched by the boat ? Is everybody sleeping ? :smiley: (It’s a joke, but i’ll wake you all, because yes, we can !!)

I post an Hex of the game for more easy try of the curent state of the game:
Fichier HEX zippé
(it’ not complete, the missed managment isn’t coded, the sound isn’t coded, the scores bonus aren’t coded and the system of speed change and regulation of paratroopers launch have to be perfect).
I want fist have the speed and launch paratrooper fixed before coding the other things. I have the original sounds on wav fomat and i have to find how to play them good or thing something like them)