I discovered PICO-8 four days ago after reading a news in The Verge about the upcoming PocketCHIP. I purchased a license (the voxatron bundle) to see what it was about and since I can't stop playing with and the numerous games / demos.
I looked at some code, read some posts on the forum and thought it could be even more funny to code.
So I decided to start with a Lode Runner remake as my first program.
It might be a bit ambitious as it's been almost 15 years I haven't coded anything serious but I have some time and I'm decided to learn.
It's still at the very early stages, I managed to fit the first level into to 128x128 and draw the sprites set :
and I can display them together :
But that's it for now...
Today, after a long weekend, I'm back to PICO-8 devellopement.
Lode Runner runs !
I had some trouble with transparency - looks like sprite 0 has to be blank (?) - not sure how flip() really works ... there must be a better way to refresh the screen than :
function _draw() rectfill (0,0,127,119,0) map(0,0,0,0,16,16) spr(runner.sprite,runner.x,runner.y) end
Moving my main sprite has been a source of satisfaction. I still need to sync the speed but it already looks nice to me.
The most difficult has been with the colision detection. It works but I'm not happy with my code.
the actor's states are far more complex than I initially thought
I should have think a bit more before diving into the code and now I think it would be better to restart from scracth before going too far.
That's the way you learn ;-)
Yay, Loderunner! This seems like a nice start.
A couple little notes:
There's nothing wrong with that _draw() routine you've got; that's pretty much bone-standard pico-8 screen drawing! Clear screen (you could also just use cls() if there's not a super specific reason you need to not redraw the bottom row of sprites), paint some map on, paint your sprites on. Everything else is just details.
- If there's no art differences between your greenshirt guy and your redshirt guy other than the colors assigned to various regions (hair, skin, shirt, shoes?), you could easily save some spritesheet by just having one version of the sprite and then associating a series of palette swaps with each runner guy in your code. e.g. just keep the top row of sprites, but store for the redshirt guy the color code pairs of green->red, yellow->dark grey, beige->brown in a list. Then when you go to draw redshirt, you'd do a quick series of pal(col1,col2) calls to change up the colors, do your spr() call, and call pal() again with no args to reset to normal colors.
Thank you all for the kind words and for your advices - much appreciated
I think I have enough code to share now - So here is my humble contribution :
I'm now looking for how I can hide the gold after running over it - ie replace the cell in the map by an empty one - same for the bricks which I need to temporary replace by sprite #34 when digging them with z/x ... any idea would be welcome.
hey Saccharine! This is looking sweet! =)
To remove objects, you can either use mset(x,y,0) to get rid of the object. Or when you load the map you can find all the treasure and make them "objects" instead (replace with 0 in the map) and draw them as sprites each frame on top of the map and remove the object when it is picked up.
For the digging you'd use mset(x,y,34) as well, to replace it, but you probably want to keep a list of timers that restore the block when it returns after it is dug.
It's been a long time I haven't played with PICO-8, busy with other tasks. I thought it would be good to give some update of my little progresses.
- new welcome screen
- the map has been populated with 6 levels
- improved runner move
- the runner can pick the gold and the score increases
- when all gold has been collected, the ladder to the next level is shown
- when runner reaches the exit, level #increases, one extra live is added - but that's it, I have now to manage to move to the next level
The guards are not managed yet, nor digging.
The code is not commented, but I tried to use self explanatory variables names, and it should be easy to read.
Please comment, any advise would be most welcome
yep ! I read a good paper on this matter a couple of days ago and realized I need to extend the character mouvement so its always stopping at the center of a tile and 'ready' to dig the left or right, climb, etc.. : http://higherorderfun.com/blog/2012/05/20/the-guide-to-implementing-2d-platformers/
You could simply snap the character to the grid (or half grid) with the dig button by player.x=/4 (or 8).
I like where this is going, too. One of my down-the-road-a-long-ways project was kind of like a world-roaming version of this with some other factors. Kind of like LR meets Terraria? If I can make that work. I have a lot of dev learning to go before I get to that point, though.
[Please log in to post a comment]