You successfully hyperspaced behind the enemy bug alien invaders to their incubation caves, but alas - your ship's controls are horribly damaged. It only fires when you turn and when you turn it slowly gets faster and faster. What's more, you can't stop the ship...
Try to take out as many of the enemy egg-pods before you crash into the cave walls.
Use LEFT and RIGHT to steer - and shoot.
Made for the Pico1K game jam 2022. The game fits into 1KB of compressed PICO-8 code thanks to cutting out anything extra and to Shrinko-8's minifying mode.
This is the same as the entry, but without the code minification and some explanatory comments added.
"How it works" summary
The game starts off by drawing some sprites for itself to use for background tiles. These are just triangles drawn line by line with rectfill and blocks (also rectfill).
Then it generates a 128*128 map of random data and applies some cellular automata calculations to it so that it's less noisy and more "chunky". I took the method from URL here. I cheat slightly and make sure there are no solid squares near the centre of the map where the ship will spawn.
As it iterates it draws on the screen to serve as the title sequence. I kinda wish I'd made it use the screen as an actual data buffer, but then I wouldn't have been able to put the title on it...
The game then matches each square in the map with one of the sprites already drawn. These are in the sprite sheet in careful order so that full/empty squares can be mapped to the number of the sprite, as follows. By considering the neighbours of a square in the sequence up, right, down, left with a full square having a value of 1 and an empty one of 0 a number can be generated by treating each position as a binary digit. The value generated points to the appropriate sprite which is already in sprite memory.
e.g. a square with empty space to the top and left, but not to the bottom and right has encoding 0011 (3) (it might be 1100 (12), I can't remember which way round I used to get it working in the end). The sprite that looks like a triangle against the right bottom is sprite 3 (or maybe 12).
The seed for rnd is taken by combining the global time, seconds, minutes...years so hopefully players won't encounter the same level too many times. In theory, if you can destroy all the enemies in a game then it will end. I don't think it's very possible.
There's a simple table of direction vectors that's used to update the velocity of the ship. Hit the left or right arrow and a different entry is used, the speed multiplier is increased and a bullet is added to the bullet table.
To save bytes and to allow checking against pixel colours from the screen, the drawing and updating code is quite interleaved. This isn't great practice these days and I wouldn't recommend it, but it was more common in the past for games of this ilk and allows some corner cutting to save space. Near the end of dev to get under the size limit I removed the _draw function entirely - this may mean it behaves strangely on some (slow?) devices.
The bullet positions are updated multiple times a frame so that they can appear to move faster - this is a handy trick that avoids having to do "proper" collision detection and still get fast bullets.
There's more line by line info in the code.
V1: fixed a bug where bullets wouldn't pass through explosions - and saved a byte. Not sure how.
V2: fixed a bug where bullets' l (life) values weren't ever decremented. If someone actually played for long enough there would be massive slowdowns and eventually PICO-8 would run out of memory.
I don't know if you have the space or can do this, @drakeblue.
Might be interesting to only increase speed every time you choose a new direction. So if you are traveling without turning, the speed does not increase.
It would only increase when you turn, making it more thinking and tactical.
[Please log in to post a comment]