I found Pico-8 a few months ago (I've been living under a rock), and I've been having a blast learning it's particular brand of Lua. After nights and weekends of watching @Krystman's Beginner Shmup Tutorial, this is the result. The code is clunky and not optimized at all, but I feel it's a "minimum viable product". Let me know what you think. Any advice is greatly appreciated.
Defender of Coryx VII
The Va'nals Empire is sweeping through the galaxy, conquering system after system with their fleet of vat-grown bio-mechanical spacecraft. The peaceful people of Coryx VII have never known conflict or war, and are woefully unprepared to face the Va'nals' threat. In a last ditch effort, the greatest minds of Coryx VII gathered together and created the prototype starship X2-SLP "Slipstream", to be piloted by a brave volunteer. Drawing its power from the dreaded bio-mech ships themselves, the Slipstream may be the people of Coryx VII's only hope. Take the controls of the Slipstream, and defend your people!
I've been following the basic shmup tutorial from @Krystman and Lazy Devs (with some adjustments) to try and learn some more of the basics in Pico 8 and Lua and game development in general after pretty much failing miserably at my first game attempt (still working on it tho.) Before finalizing enemy behavior and the spawning (my difficulty is still wildly inconsistent), I wanted to work on the boss explosion, but I've run into a bug I can't seem to figure out. I can't get the timer to delete the boss after the cool explosions to actually count down. I've set the boss HP low and the wave to the final one for testing if anyone can help me out understanding what I've done wrong here. I'd also appreciate any advice anyone has regarding creating a proper scaling difficulty.
I'm having trouble with my player movement after my map updates. My map seems psuedo-randomize after the 1st screen like I want (I can tinker and fix this later). The trouble I'm having is that my player won't continue moving upwards after the map redraws and resets your position. Essentially every screen seems to treat the lower half as if it's the first screen ie running the collision detection on sprites that don't seem to be there. I'm stumped. Any help would be much appreciated.
Like the title says, I have rudimentary collision detection on the top and sides of my sprite but not on the bottom.
I'm very new to game dev, but I have some experience in python. I can't see if I have a typo, or I've made a mistake in following the tutorial I watched.
--player--
function create_player()
player={
state="normal",
sprite=1,
health=4,
x=64,
y=82,
h=8,
w=8,
gravity=0.30,
friction=0.15,
inertia=0,
thrust=0.80
}
end
function collide(o)
local x1=o.x/8
local y1=o.y/8
local x2=(o.x+7)/8
local y2=(o.y+7)/8
local a=fget(mget(x1,y1),0)
local b=fget(mget(x1,y2),0)
local c=fget(mget(x2,y2),0)
local d=fget(mget(x2,y1),0)
if a or b or c or d then
return true
else
return false
end
end
function move_player(o)
o.y+=o.gravity --applies player gravity
local lx=o.x --last x pos
local ly=o.y --last y pos
if (btn(❎)) o.y-=o.thrust --player move
if (btn(⬅️)) o.x-=0.5
if (btn(➡️)) o.x+=0.5
--if the player collides, moves back
if collide(o) then
o.x=lx
o.y=ly
end
end
function ani_player(o)
if btn(⬅️) then --player animation
o.sprite=2
elseif btn(➡️) then
o.sprite=3
else
o.sprite=1
end
end
function draw_sprite(o)
spr(o.sprite,o.x,o.y)
end
Sorry if this is a completely dumb question. I'm new to Pico 8 and game dev in general. I'm stuck in my first project attempting to randomize map layouts. My game is a simple vertical scrolling game where the player moves from side to side to avoid obstacles. I'd like to begin on one screen, and then end on a final screen with the ones in between being a random selection from the 12 or so other screens I've drawn. I know the easiest way to do this is probably with nested tables, but I'm having trouble understanding how I could accomplish this. Any help would be awesome.