Flappybird for MATLAB
Author: Mingjing Zhang
As one of the most popular games on app stores before being taken down, Flappy Bird does not need any further introduction. Now, it has come back alive, on MATLAB.
This implementation is intentionally made to replicate the user experience of the original game, with all physical dimensions of objects being identical. The gravity and 'jumping pulse' are also carefully adjusted so that they match the original as closely as possible.
*MATLAB R2014a is recommended for this game to achieve the best graphical performance
Usage:
Simply execute flappybird.m. Alternatively, you can install "Flappy Bird.mlappinstal" as a MATLAB app.
Control:
Spacebar/Return/Uparrow/W/ -> Jump/Start game/Restart game;
ESC -> Quit Game.
Note:
This game app features a few technique breakthroughs that I utilize in a game for the first time. For instance, the bird sprite is represented as a SURFACE object, as opposed to an IMAGE object, so that it can easily rotate at any angle.
** If you encounter any problem, or have any suggestions / feedbacks, please drop a comment down below. **
Enjoy the endless flapping!
Mingjing Zhang (2019). RoteAugen/flappybird-for-matlab (https://www.github.com/mingjingz/flappybird-for-matlab), GitHub. Retrieved .
1.1.0.0 | Reinserted the description deleted by system after migrating to github |
|
1.1.0.0 | Migrated to github |
|
1.1.0.0 | Updated a note clarifying that MATLAB 2014a is the best environment for this game. |
|
1.1.0.0 | Oct 10, 2014
|
Inspired: pab47/FlappyBirdController, SpriteKit Framework
Create scripts with code, output, and formatted text in a single executable document.
Allan (view profile)
Error:File: flappybird.m
Line: 169 Column: 25
Identifier
'ScoreInfoBackHdl' is not
a function or a shared
variable
to fix this ,you should add two line code on the "Handles" section.
%% Handles
MainFigureHdl = [];
MainAxesHdl = [];
MainCanvasHdl = [];
BirdSpriteHdl = [];
TubeSpriteHdl = [];
BeginInfoHdl = [];
ScoreInfoBackHdl = []; % add this line
ScoreInfoForeHdl = []; % add this line
FloorSpriteHdl = [];
ScoreInfoHdl = [];
GameOverHdl = [];
FloorAxesHdl = [];
Andrew Janke (view profile)
António Oliveira (view profile)
Anyone knows how to fix this problem?
Error:File: flappybird.m
Line: 169 Column: 25
Identifier
'ScoreInfoBackHdl' is not
a function or a shared
variable. To share
'ScoreInfoBackHdl' with
nested function,
initialize it in the
current scope. For more
information, see Sharing
Variables Between Parent
and Nested Functions.
Walter Broeckx (view profile)
Esperanza Linares Guerrero (view profile)
I tried to run it using MATLAB 2019b and got an error about ScoreInfoBackHdl and ScoreInfoForeHdl not being a function or shared variable. I initialized them (I included ScoreInfoBackHdl=[]; and ScoreInfoForeHdl=[]; in the %% System variables section and it seems to fix the problem.
Matthew Chihata (view profile)
I only have access to the newer version of MATLAB (r12019a). Is there anyway to fix the graphics?
gong Yang (view profile)
Herib Puga (view profile)
Justin Hadyniak (view profile)
Jeremy Sands (view profile)
Anyone else have an issue with this causing MATLAB to crash when you lose the game?
Nikhilkumar Maheshbhai (view profile)
It's so fun if you change some parameters in the code.
Mohaned Khaled Serag El-Den (view profile)
Amazing!
scor pioor (view profile)
amazing game, even though i never play it!
Ngoc Doan (view profile)
Jie Liao (view profile)
Carlos Romo (view profile)
Dmytro Karpushko (view profile)
Asmaa Saleh (view profile)
Behnam Azizi (view profile)
BAPUJI KHATUA (view profile)
Jeffrey Hung (view profile)
xi zig (view profile)
zichi~
Jian Li (view profile)
66666~~~~~~~~~~~~~~
Jeremiah Littrice (view profile)
Is there any way to change the bird into another surface image?
ding chen (view profile)
very Good
K. Kojima (view profile)
Melanie Magdun (view profile)
K. Kojima (view profile)
Nice work
jian zhing (view profile)
6666
Han Feng (view profile)
Rodolfo (view profile)
Dhinesh Ram K (view profile)
John Hedengren (view profile)
Here is one implementation of automatic control with this Flappy Bird application.
http://youtu.be/XxPe0HJLkVs
It is surprising that a simple P-only controller can do very well.
TT (view profile)
Mohammad Abouali (view profile)
nice. This should be selected by mathworks as featured
Yu (view profile)
I like this game,I believe I can always fly.
Moath Awawdeh (view profile)
Wonderful work Mingjing Zhang :)
Adivhaho Magoma (view profile)
Nice game,but hard not to collide
Turner Conrad (view profile)
I hate my life now. Thanks.
RayJo (view profile)
Great work! Thank you! This is a good example to learn creating small but funny games in Matlab.
Zohar Bar-Yehuda (view profile)
mlabviet (view profile)
nice
dat nguyen (view profile)
Tim (view profile)
jacky chen (view profile)
Guodong (view profile)
David Barry (view profile)
Good effort!
You need a slight modification to your code if you are packaging as an app. You need to make sure that the main fuction which you package returns a figure handle so that the app removes itself from the path when you close it.
Ghozali Hadi (view profile)
Amazing...
@Rabih have you use the pacakage of this submission by downloading "Download Submission"?
Or I think you have problem with your directory. Because matlab couldn't load *.mat file
Harvey Abaya (view profile)
i was thinking of doing this, but kept it a fantasy. This is a work of passion and skill. Awesome Job!
Rabih (view profile)
it doesn't work in matlab R2012 a. I get:
Error using load
Unable to read file sprites2.mat: No such file or directory.
Error in flappybird/initVariables (line 276)
Sprites = load('sprites2.mat');
Error in flappybird (line 94)
initVariables();
WEIGUANG HU (view profile)
the game is very similar with the original one on the iphone. Thank you for your efforts. And I suggested this app to my friends already.
Darshan Pandit (view profile)
great!
Nakk Mungofa (view profile)
wow! u actually did this?? amazing! ...and funny!
Ligong Han (view profile)
终于等到matlab版了!学习了!感谢!
Ligong Han (view profile)
Jason Nicholson (view profile)
It is hard to believe you took the time to make this. Funny! :)
Jason Nicholson (view profile)
Interesting! :)