METAFlappy

Creations

UnPolacoLoco

5 years ago

Hello!

As a little programming exercise, I decided to port the well know and cough cough loved Flappy Bird. I'm practicing separating different functionalities into separate objects; I'd appreciate someone taking a look at the source code and seeing if I'm on the right track learning this kind of stuff.

I don't think it needs much introduction. Your job is to fly between pipes, one hit and you're dead. 

Gameplay:

Press "A" to jump.

 

You can set the game speed and the space between the pipes in the main menu, in case you need more of a challenge.


Enjoy and let me know what you think! As always any comments and tips appreciated!



View full creation

mike_j503

NEW 5 years ago

Just as addictive as other versions of this game.

I don't know though if the gameplay feels exactly the same. Maybe the jumps need to be smaller? 

Still need to play more to be sure.

UnPolacoLoco

NEW 5 years ago

Yeah, I spent some time trying to get it right but it never felt exactly the same. There are 4 variables that affect the feel of the bird.

  • Gravity - how fast the bird falls
  • Friction - not necessarily needed but I felt it made the bird fall a bit smoother
  • Jump - when 'A' is pressed it adds a set amount to your Y position
  • The speed of the obstacles - FAST is -2 and SLOW is -1. Essentially how fast the world scrolls towards you. 

Gravity, Friction and Jump can be manipulated in the Player class. The speed of the obstacles can be found in the Obstacle class

Feel free to mess around with that to your liking :)


EDIT: There is also a BUTTON_COOLDOWN variable which forbids spamming the jump button.

geed

NEW 5 years ago

Addictive game !!

But can you add a very small function : Saving our settings between two games ? It's easyer when you "chase" score !


UnPolacoLoco

5 years ago

Thanks for the feedback! I went back into the code and implemented just that, that was a good idea :)

Sorunome

NEW 5 years ago

Fun game! Taking a look at the source, you are manually calling gb.pickRandomSeed();, however this isn't needed, gb.begin(); already does this implicitly! (i should really add a reference page for that function...)

I also noticed that the high score doesn't save between console restarts, digging into the code i found this: https://github.com/UnPolacoLoco/METAFlappy/blob/master/METAFlappy/ModeHandler.cpp#L16

The problem with doing this in the constructor is, that if you create the objects in global space like you do here the constructors are called before any other code is executed - that is before gb.begin(); runs.....and thus before the SD card is initialized! To fix this, you could make an init method and call that after gb.begin();

UnPolacoLoco

5 years ago

I was wondering why I couldn't get the saves to work properly... I've implemented a simple score initialization routine based on your feedback. Thanks for the tips! 

With this knowledge, I've expanded what the game saves. Now score is kept separately between different speeds and window height combinations.

UnPolacoLoco

NEW 5 years ago

geed geed

Thanks for the feedback! I went back into the code and implemented just that, that was a good idea :)

UnPolacoLoco

NEW 5 years ago

Sorunome Sorunome

I was wondering why I couldn't get the saves to work properly... I've implemented a simple score initialization routine based on your feedback. Thanks for the tips! 

With this knowledge, I've expanded what the game saves. Now score is kept separately between different speeds and window height combinations.

jicehel

NEW 5 years ago

You can check out the source code of UFO-Race that show how you can use it. I'll add and use the highscore.ino in the 2 converted games from Yoda soon too. It's easy t use. Just have to adjust some little parameter (for example for him, the best score is the lowest... for me it's the better, for you too i think. 

UnPolacoLoco

5 years ago

Thanks! I've gone back to the source code and made some slight adjustments. It should be working now! :)


UnPolacoLoco

NEW 5 years ago

jicehel jicehel

Thanks! I've gone back to the source code and made some slight adjustments. It should be working now! :)