After some feedback from my resident play-tester, I've made some small changes to my stickman cart from yesterday that should make the gameplay experience a bit more engaging.
New features:
- High scores
- Instructions when you start the game
- Added a delay on the start and game over screens, so it's easier to read what those screens say
If this is the first time you're seeing this game, here's some info:
The aim of the game is to try and survive as long as possible. If you touch one of the green blobs then you lose.
You can move around, jump, and shoot bullets at the blobs. But whatever you do, don't touch them. Good luck!
Good early effort in PICO-8! You're overthinking your garbage collection a bit, though. You don't need to expressly track and delete things from a garbage table, you just need to remove all references of an object and Lua will collect them for you.
In fact, I don't your garbage removal code is working as intended; I was able to get an out of memory error after a few minutes of play.
del() removes references to objects, it doesn't actually do anything to the object itself. In your code, you're adding object references to the garbage table, but you're never actually deleting those references from the objs table:
if (o.is=="enemy" and o1.hurts=="enemy")
or (o1.is=="enemy" and o.hurts=="enemy") then
local x=o.x
local y=o.y
local e=explosion(x,y)
add(explosions,e)
sfx(2)
add(garbage,o)
add(garbage,o1)
end
|
As a result, your garbage table gets cleared out, but everything in it is still referenced in the objs table, so Lua leaves the objects in place.
You can strip out all of your garbage collection code and simply use del() where you're currently adding things to the garbage table. That'll save complexity, time and tokens!
Not bad! If I can make a suggestion: Holding down the shoot button makes avoiding blobs trivial, so I think it would be more fun/challenging if there was some kind of limit on bullets.

Thank you both! I removed the garbage collection and added ammo so you can't just hold on x to shoot, and it's made the code neater and the gameplay a bit better :)
[Please log in to post a comment]




