#Mario - Style Game On Flipper Zero
3 messages · Page 1 of 1 (latest)
#!/bin/sh
Application metadata
app_name="Mario"
app_version="1.0"
app_dependencies="sh"
Initialize the game
player_position=0
game_over=false
Main game loop
while [ $game_over = false ]; do
Clear the screen
clear
Draw the platforms
echo ""
echo "* "
echo " "
echo " "
echo " *"
echo ""
Draw the player
for i in $(seq 1 $player_position); do
echo -n " "
done
echo "O"
Get input from the player
read -n 1 input
Update the player's position based on the input
case $input in
"a")
if [ $player_position -gt 0 ]; then
player_position=$(($player_position - 1))
fi
;;
"d")
if [ $player_position -lt 28 ]; then
player_position=$(($player_position + 1))
fi
;;
esac
Check for game over conditions
if [ $player_position -eq 0 ] || [ $player_position -eq 28 ]; then
game_over=true
fi
done
Game over message
echo "Game over!"
(this is the script)