-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a code example for the Flappy Bird-clone from Hackaday Berlin
- Loading branch information
Showing
6 changed files
with
1,328 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Simen E. Sørensen | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
TARGET=flappy | ||
PORT?=/dev/ttyUSB0 | ||
ASSEMBLER=../../assembler/assemble.py | ||
|
||
all: assemble program | ||
|
||
assemble: $(TARGET) | ||
|
||
$(TARGET): $(ASSEMBLER) $(TARGET).asm | ||
$(ASSEMBLER) $(TARGET).asm | ||
|
||
clean: | ||
rm -f $(TARGET).hex | ||
|
||
program: | ||
stty -F $(PORT) raw | ||
cat $(TARGET).hex > $(PORT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Flappy Bit | ||
_Copyright (c) 2023 Simen E. Sørensen | [@simenzhor@mastodon.social](https://mastodon.social/@simenzhor)_ | ||
|
||
------------------------- | ||
A Flappy Bird clone for the Supercon/Hackaday Berlin badge. | ||
|
||
## Acknowledgements | ||
- I have used some functions from Octavian Voicu's "General Purpose Library" in [octav-snake](../octav-snake/snake.asm). | ||
- Octav's original library is written for a game played in portrait mode, so I have modified some functions to work better in landscape mode. | ||
- I have kept Octav's original coordinate system, where x exists in the range 0-7 and y in the range 0-14. The coordinate system's origin is in the top left corner of the screen (assuming portrait mode) near the R0/PAGE+1 labels | ||
|
||
- I have used the registry definitions from Bradon Kanyid / Rattboi in [rattboi-falldown](../rattboi-falldown/falldown.asm). | ||
|
||
- I have used the Makefile from Adam Chasen in [achasen-symbolscroll](../achasen-symbolscroll/Makefile) | ||
# Building | ||
|
||
To build the binary, run: | ||
``` | ||
make assemble | ||
``` | ||
|
||
To load onto the badge | ||
1. Verify that the port specified in the Makefile matches yours: | ||
|
||
2. Run `make all` | ||
|
||
# Gameplay | ||
|
||
Fly past as many obstacles as possible. | ||
Flap your wings to gain altitude, or let gravity pull you down towards the ground - but avoid crashing with the floor, ceiling or the obstacles you zoom past! | ||
The difficulty increases as you pass by obstacles. | ||
|
||
# Keys | ||
|
||
The LSB key in the OPERAND Y section makes the bird jump. It is labeled | ||
* 1/++++ | ||
|
||
After the game is over, press any key in the OPERAND Y section to restart the game. | ||
|
||
# High Score in Hackaday Berlin-Mode | ||
If you played the game live at Hackaday Berlin, you may know that the game became borderline impossible to play as wall number 15 spawned. I have spent a bit more time balancing the game now, so it should be more fun to play, but if you are up for an extra challenge: flash your badge with `hackadayberlin-mode.hex` which is the original hex-file I showcased at the event. | ||
|
||
The world-record in Hackaday Berlin-mode is 19 walls and is held by [@bleeptrack@vis.social](https://vis.social/@bleeptrack)! | ||
|
||
# High Score in Source Code-Mode | ||
My personal best score in the version that is published here is 23 walls, but that should be possible to beat, so toot at [@simenzhor@mastodon.social](https://mastodon.social/@simenzhor) if you manage to beat either of the high scores :D |
Oops, something went wrong.