Flappy Birdie - A Flappy Bird Clone [1.5 UPDATE]

(Leo) #1

Hard mode is added in this update, I couldn’t get pass pipe 10!
Also a strange bug that causes the Hi-Score of Hard Mode to be changed to 256. :frowning:
If you can please tell me the problem I will turn that frown emoji into a smile one.

I created a little Flappy Bird clone for the Arduboy.
It’s name is Flappy Birdie.
It’s pretty similiar to Flappy Bird
Game Logo

This is the first game I made for the Arduboy.
Please tell me if you found a bug so I can fix it in future releases.

Press A to make the little birdie fly!
Avoid hitting pipes or crashing into the ground.
The game gets a little bit harder after reaching 10, 20 and 50 points.

Source code is available here:

Also if anyone is interested in Flappy Bird, it’s available for Android and iOS.

Running Arduboy sketches on a UNO or other 328p based board
(Scott) #2

Nice! A more sophisticated version of a game that was ported to the original Arduboy prototype.

Just an F.Y.I.:
The Arduboy2 library contains functions for controlling the RGB LED. By replacing the Arduino pin functions that you’re using with Arduboy2 functions, you can save 392 bytes of code.

You can remove line 50:
The library already sets the RGB LED to the proper mode.

Change line 90:

if(arduboy.notPressed(B_BUTTON)) {DeleteTimer = 0; digitalWrite(RED_LED, HIGH);}


if(arduboy.notPressed(B_BUTTON)) {DeleteTimer = 0; arduboy.digitalWriteRGB(RED_LED, RGB_OFF);}

Change line 160:

    digitalWrite(RED_LED, LOW);


    arduboy.digitalWriteRGB(RED_LED, RGB_ON);

(Leo) #4

Hey, can you also help me with a small warning?

I ingored it for some time, but I want to fix it just in case it causes errors.
Since you helped me already, I thought to myself maybe you can help me again? Possibly?
Anyway, you probably already noticed it but when compiling, it says this:
warning: narrowing conversion of ‘((pipe[i].Pipe::level + 16) * 2)’ from ‘int’ to ‘uint8_t {aka unsigned char}’ inside { } [-Wnarrowing]

Rect pipe2Rect = Rect{pipe[i].x,pipe[i].y + 68 - pipe[i].level * 2,16,32 + pipe[i].level * 2};

If you can help me I would be grateful!

(Pharap) #5

That warning doesn’t appear to be for the block of code you posted, unless you’ve tweaked it since the warning was generated.

What the warning means is that the width and height fields of Rect are uint8_t (which are 8 bits wide), but the operations you’re using convert them into int (which is 16 bits wide on the Arduboy) so they have to be ‘narrowed’ down to 8 bits to fit.

It’s a warning because the upper 8 bits are lost as a result of the narrowing conversion from int to uint8_t, so the compiler tells you to make sure you’re not making a mistake.

If you’re sure that you want to narrow the result to 8 bits then you can wrap the value in a static cast, e.g.

Rect pipe2Rect = Rect { pipe[i].x, pipe[i].y + 68 - pipe[i].level * 2, 16, static_cast<uint8_t>(32 + pipe[i].level * 2) };

If you need Rects with a height or width of more than 255 then you’ll need to write your own version of Rect.

(Scott) #6

You may also wish to address other warnings that are generated by your code at higher compiler warning levels. In the Arduino IDE go into preferences:
File > Preferences
and select Compiler warnings: All

(You don’t have to worry about the warnings from EEPROM.h since they’re not from your code.)

(Leo) #7

Okay, thank you guys!

(Bogdan-Constantin Stoica) #8

Hi, I just got my Arduboy. I managed to transfer the game and it plays well, but there is no sound. I don’t know much about programming so please bare with me. :slight_smile:

(Scott) #9

It’s possible that your system is set to mute. Try unmuting using the System Control feature:

  • Press and hold the B button while powering up the Arduboy. The blue RGB LED should come on.
  • While continuing to hold B, press the UP button. The RGB LED should flash green and then change back to blue.
  • Release the button(s) to continue with sound enabled.

(To mute the sound, do the same as above but press DOWN instead of UP. The LED will flash red.)

(Bogdan-Constantin Stoica) #10

It worked! Thank you!

(Leo) #11

StBog were you using the reset button?

(Bogdan-Constantin Stoica) #12

No i didn’t use it. And for some reason i have encountered the same problem again. I transfered the game again, unmuted the system, but there is no sound. Also from time to time there is this bug where if I pause i get points while paused at a rapid speed…

(Erwin) #13

I uploaded your game to http://arduboy.ried.cl

If you add a license I can update it in the repo.

(Leo) #14

StBog, you are probably using an older version of the game, I have updated the game in which the bug is fixed!

(Leo) #15

eried, i won’t be licensing my game

(Scott) #16

Then you should state this somewhere in the source code or a separate license file.

If you wish to place it in the public domain, so anyone can do whatever they want with it, you can say something like:

To the extent possible under law, <your name> has waived all copyright and
related or neighboring rights to this program.

(Pharap) #17

There ought to be some kind of licence agreement or copyright notice.

Even closed source games have EULAs to stop people disassembling the compiled code.

Otherwise how can anyone know how many copies they’re allowed to keep or what they’re not allowed to do?

There at least needs to be a copyright notice stating things like “you may keep as many copies of the file as you like” and “you may not attempt to disassemble the code”.

If you’re staying closed source, might I suggest a creative commons BY-NC-ND licence?

It permits sharing, forces people to give credit to you, prevents people from using the game for commercial purposes and prevents people making derivatives.

(Leo) #18

Well I checked it out and added the license to my game… thanks!

(Pharap) #19

If you don’t mind me asking, is there a particular reason you don’t want to permit derivatives?

It’s quite unusual for Arduboy games to not allow derivatives, and the others that don’t tend to be completely closed source (i.e. they don’t make the source code available, just the .hex file).

(Leo) #20

What do you mean by that?

(Alex) #21

Shoot, theres already a flappy bird clone on here :sweat_smile:
I kinda want to port the clone I made with python on my Github to the arduboy, not sure if I should do it now.