ULAM.P8


my first try ended up giving a OUT OF MEMORY error on the BBS, I hope this one works.
Renders Ulam spiral starting at 0 rotating counterclockwise.
Shoutouts to JWinslow23 for bringing me down to my senses with how to map the numbers within the position table haha
controls
Mouse - Select number
MB1 - Show number and highlight diagonal primes


A prototype I whipped up in two hours, my first completed "game", now I just want to polish it a bit, adding in some fade-ins or something for the reply-reveals
Please enjoy
EDIT
0.4 Now with sound!



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

