I have a number of functions which, before doing any real work, need to do the exact same pre-processing routine of the passed parameters. As such, they all start like this...
local p1, p2, error = preprocess(param1, param2) if (error) return error --early return |
Is there a way to use metatables to inject this kind of default behavior into functions, without having to copy/paste that boilerplate code each time?
EDIT_2
lol nevermind I figured it out. I'm so happy about this
EDIT!
so I finally came back to this and got some of the fixes implemented, but now every time my character collides with a surface they teleport back to the top of the screen. Can someone point out what I'm doing wrong?
Thanks again
original post:
I'm stuck again, this time on why my movement isn't working correctly.
When I try to go left, all movement and physics stop. when I try to go right, I "jump" and then fall through the floor.
additionally, the jump "boost" only works when also moving right
i'm following along with the NerdyTeachers YouTube tutorial, but I've rewatched the vids I think would make sense for these issues at least 3x each and I'm still stuck
I have a raspberry pi with a cheap USB controller plugged in to it. I would like to fx press the select button and the green button which will then start up splore using the pico8 -splore command. The reason is that I now have to have a keyboard connected to the pi which would be nice to remove
But I have not been able to get it working. I have tried keyboard shortcuts and xbindkeys. But none of this helped. Anyone have any suggestions?
Maybe this is me being stupid, but no matter how I look at it I feel like my code should be working.
Button presses are working in the title screen and dialogue sections, but for some reason it stops working in the main gameplay. The code looks sound to me and everything else behaves as it should, debugging has shown me that the functions are indeed being called. But inputs just don't work. Here is where the offending code could be:
[hidden]
function init_battle() t=0 --keeps track of time for bullet timing pl_shot ={} boss_shot={} actor={} player = { x=60, y=100, life=3, speed=2, focus=0, life =3, box ={ xa=0, xb=2, ya=0, yb=2 } } boss = { x=60, y= 40, life=100, spell=1, box = { xa=0, xb=3, ya=0, yb=3 } } music(22) _update=update_battle() _draw=draw_battle() end function update_battle() player_movement() end function player_movement() if (btn(0))then player.x-=player.speed end if (btn(1)) then player.x+=player.speed end if (btn(2)) then player.y-=player.speed end if (btn(3)) then player.y+=player.speed end end function draw_battle() cls() map(0,0) spr(1,player.x,player.y) draw_hud() end function draw_hud() spr(14,100,0) for i =108,124,8 do spr(15,i,0) end for i = 8,112,8 do spr(30,100,i) end spr(25,100,120) rectfill(108,8,128,125,13) end |
Here is a small game I made for a game jam that imposed the restriction of a Nokia 3310:
- 84x48 resolution
- 2 green colors
- 15 fps
- limited number of buttons
- monophonic sound
I made a custom html5 viewer to let me have the exact colors, playable on itchio (game is the same otherwise): https://frozax.itch.io/lights-on-3310
I've found a weird glitch with the sounds on web, it seems to happen at random. Reloading the page fixed it for whatever reason, but reseting the cart didn't.
Ignore the black flashes around halfway in the video, i'm not sure as to what caused those, but they weren't there when I first recorded it.
Video of the glitch: https://youtu.be/r_i2HjsvCP4
Hey so I just noticed that one of the more recent PICO-8 updates (not sure which) appears to make palettes work inconsistently on text in certain cases.
How to Reproduce:
Play my game Night Fright Flight here on the forums: https://www.lexaloffle.com/bbs/?tid=30133.
Try to change the palette through the pause menu, and you'll notice that some of the text (specifically the score and the game over message) doesn't entirely change palette. Most strangely, it applies only partially to outlined text created by calling print repeatedly with different offsets (despite pal() not getting called in the text drawing function at all).
I get the same issue running the game with 0.2.1b on my computer.
Example 1: The partially-purple text outline here should be all green.
[i]Example 2: The orange text with an upper purple shadow here should be white with a red shadow.
83 levels - featuring lemmings! - of classic platform puzzler.
Controls
[Z] and [X] dig
Hold [X] if you get stuck to restart level
[Q] to quit back to titles
Thanks To
Finn for testing
Doug Smith for creating the 1983 classic
Mike Dailly for creating the original lemmings sprites
Zep for the confetti tweetcart I used for the game complete scene
PICO-8 for creating an awesome "fantasy console"
Minified using the GEM Minifier:
https://pahammond.itch.io/gem-minify
Unminified code can be downloaded from:
https://pahammond.itch.io/lode-runner