il y a 6 ans
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!
NEW il y a 6 ans
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.
NEW il y a 6 ans
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, 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.
NEW il y a 6 ans
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
il y a 6 ans
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.
NEW il y a 6 ans
Thanks for the feedback! I went back into the code and implemented just that, that was a good idea :)
NEW il y a 6 ans
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.
NEW il y a 6 ans
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.
NEW il y a 6 ans
Thanks! I've gone back to the source code and made some slight adjustments. It should be working now! :)