This is my port of an Android mobile game made by myself and my classmates for our Mobile Games unit.
I recently needed a countdown timer for a game I wanted to port but wasn't able to find a tutorial online. The code wasn't exactly difficult, but it would have saved me some time, so I figured I would upload the template I made for myself so others could use it.
This will show the timer on screen in total seconds (set to the highest maximum number by default) and in digital clock format (00:00:00).
-- countdown timer
-- by ryanb_dev
-- hours:minutes:seconds
-- max 32767 seconds
-- 9:06:06
function _init()
timer = {
text = "",
hours = 0,
minutes = 0,
seconds = 0,
active = true,
seconds_left = 32767,
math_seconds = 0,
}
last_time = time()
end
function _update60()
if (timer.active) then
timer_update()
end
end
function _draw()
cls()
//actual seconds
print(timer.seconds_left)
//clock format
print(timer.text)
end
function timer_update()
timer.text = ""
timer.seconds_left -= time() - last_time
timer.math_seconds = timer.seconds_left
last_time = time()
timer.hours = flr(timer.math_seconds / 3600)
timer.math_seconds -= timer.hours * 3600
timer.minutes = flr(timer.math_seconds / 60)
timer.seconds = flr(timer.math_seconds % 60)
timer.text = timer.text.."0"..tostr(timer.hours)..":"
if timer.minutes < 10 then
timer.text = timer.text.."0"..tostr(timer.minutes)..":"
else
timer.text = timer.text..tostr(timer.minutes)..":"
end
if timer.seconds < 10 then
timer.text = timer.text.."0"..tostr(timer.seconds)
else
timer.text = timer.text..tostr(timer.seconds)
end
if (timer.seconds_left <= 0) then
timer.active = false
end
end |
This is a demo for a game I did for class which I hope to expand on in my free time, when I actually have some of that again lol.
You play as the volcano god of an island city. When foreign ships carrying missionaries of another god arrive at your shores and convince the villagers to convert and stop their worship of you, you get revenge by destroying the city with your fireballs.
X to fire a shot
Goal is to destroy as much as you can in 10 shots
Some areas give more points than others
This is my first foray into pico-8, which I started yesterday after my teacher showed the class the basics. My code's probably messy because I prioritized learning the ropes and getting the game working. I might fix it up later.
Game modes are:
- Single player - hit the ball against the opposite wall, with the ball's speed increasing over time. Tracks the high score per cartridge boot.
- Two player - play against a friend in classic Pong.
- VS Computer - play against an AI with easy, medium, and hard difficulties.
All modes currently feature endless gameplay.





  0 comments