Flutter game Tap Hero
Tap Hero is a small and very simple game developed by Mariano Zorrilla. This game was developed without any game engines and entirely with Flutter. Maybe it is a bit old project now but still, but you can still learn a thing or two from it. I think the great way of learning is by studying small apps and trying to understand how they work.
The game was developed to work on:
- Android
- iOS
- Desktop
- and Web
At the time of writing the web game is still operational at this link: https://gametaphero.web.app
The app itself doesn’t use a lot of plugins and to be more precise it uses only three, where one is a share plugin and the other is audioplayers and simple_animations.
It is worth mentioning, this game wasn’t designed and developed with null-safety in mind so in order to work now it needs to be a bit improved.
For me, the mode interesting part of this game code was a gameEngine(widget), gamePanel(widget), and sitePanel(widget), which are in game.dart file. Basically, it divides a screen into two parts. The usage of the above-mentioned widgets is quite simple. The game detects the width of the screen and renders gamePanel and sidePanel in a Row or in a Column.
Widget gameEngine(BuildContext context) {
return width(context) >= 700
? Row(
children: <Widget>[
gamePanel(),
sidePanel(),
],
)
: Column(
children: <Widget>[
gamePanel(),
sidePanel(),
],
);
}
The game panel is quite simple too. It uses a Stack widget to place the graphics on the screen and also detects the clicks. It also detects the width of the screen too
Below you can find the original description from the project page, some screenshots, and a link to the project page on GitHub.
TapHero is a casual tapping arcade game. This repo includes Android, iOS, Desktop (macOS, Windows, Linux). For Flutter Web, check the TapHero Web Repo.
Screenshots
LIcense
Source code on GitHub