stanleycan8668 [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=82982 Splore: How to access games offline? <p>I have a handheld device (RG351V) that runs Pico 8 and Splore. I like to browse Splore at home while connected to Wi-Fi and Favorite games that I like. When I do that, some games are playable even offline, but some are not and give the error &quot;could not connect to BBS.&quot;</p> <p>I am not doing any special steps like downloading the cart manually. Some just seem to randomly work offline without me doing anything. Can anyone help me figure out what's going on? I'd like to play them all offline as easily as possible.</p> https://www.lexaloffle.com/bbs/?tid=55512 https://www.lexaloffle.com/bbs/?tid=55512 Wed, 27 Dec 2023 19:42:37 UTC Help with Collision <p><em>Error: Attempt to index global 'W' (a nil value)</em></p> <p>Hello! I am having trouble getting collision working with a different system that spawns sprites in from the map screen.</p> <p>This is the collision tutorial I used: <a href="https://youtu.be/Recf5_RJbZI?si=Df6FbJ2FYfCN39Qx">https://youtu.be/Recf5_RJbZI?si=Df6FbJ2FYfCN39Qx</a><br /> This is the sprite spawning tutorial I used: <a href="https://youtu.be/8jb8SHNS66c?si=233nn8z_S1R4R64n">https://youtu.be/8jb8SHNS66c?si=233nn8z_S1R4R64n</a></p> <p>I have watched TONS of tutorials on this and still can't wrap my head around it. A lot of tutorials create very basic collision that has issues, like only being able to work with certain speed values (1,2,4,8,16,etc.) or that don't let your character slide alongside a wall when holding a diagonal.</p> <p>Can anyone help? I definitely want to use this spawning system in the future to spawn in different types of walls and enemies. I have a feeling that I am misunderstanding how to use the table variables properly, so any explanation would be appreciated!</p> <div> <div class=scrollable_with_touch style="width:100%; max-width:800px; overflow:auto; margin-bottom:12px"> <table style="width:100%" cellspacing=0 cellpadding=0> <tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> <td background=/gfx/code_bg0.png> <div style="font-family : courier; color: #000000; display:absolute; padding-left:10px; padding-top:4px; padding-bottom:4px; "> <pre>-- game loop -- function _init() cls() walls={} make_player() make_walls() -- top-left and lower-right -- bounds of player area a1,b1=8,8 a2,b2=112,112 end function _update60() -- keep inside the play area move_player() p.x=mid(a1,p.x,a2) p.y=mid(b1,p.y,b2) end function _draw() cls() draw_map() draw_player() for w in all(walls) do spr(w.wsp,w.wx,w.wy) end end</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <div> <div class=scrollable_with_touch style="width:100%; max-width:800px; overflow:auto; margin-bottom:12px"> <table style="width:100%" cellspacing=0 cellpadding=0> <tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> <td background=/gfx/code_bg0.png> <div style="font-family : courier; color: #000000; display:absolute; padding-left:10px; padding-top:4px; padding-bottom:4px; "> <pre>-- map -- function draw_map() map(0,0,0,0,16,16) end</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <div> <div class=scrollable_with_touch style="width:100%; max-width:800px; overflow:auto; margin-bottom:12px"> <table style="width:100%" cellspacing=0 cellpadding=0> <tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> <td background=/gfx/code_bg0.png> <div style="font-family : courier; color: #000000; display:absolute; padding-left:10px; padding-top:4px; padding-bottom:4px; "> <pre>-- player -- function make_player() p={ x=40, y=40, w=8, h=8, speed=2, sprite=1, } end function move_player() --move player with buttons --interacts with wall collision if (btn(⬅️)) then for newx=p.x,p.x-p.speed,-1 do if not box_hit(newx,p.y, p.w,p.h, w.wx,w.wy, w.ww,w.wh) then p.x=newx end end end if (btn(➡️)) then for newx=p.x,p.x+p.speed do if not box_hit(newx,p.y, p.w,p.h, w.wx,w.wy, w.ww,w.wh) then p.x=newx end end end if (btn(⬆️)) then for newy=p.y,p.y-p.speed,-1 do if not box_hit(p.x,newy, p.w,p.h, w.wx,w.wy, w.ww,w.wh) then p.y=newy end end end if (btn(⬇️)) then for newy=p.y,p.y+p.speed do if not box_hit(p.x,newy, p.w,p.h, w.wx,w.wy, w.ww,w.wh) then p.y=newy end end end end --draw player function draw_player() spr(p.sprite,p.x,p.y) end</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <div> <div class=scrollable_with_touch style="width:100%; max-width:800px; overflow:auto; margin-bottom:12px"> <table style="width:100%" cellspacing=0 cellpadding=0> <tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> <td background=/gfx/code_bg0.png> <div style="font-family : courier; color: #000000; display:absolute; padding-left:10px; padding-top:4px; padding-bottom:4px; "> <pre>-- walls -- function make_walls() for x=0,15 do for y=0,15 do if mget(x,y)==65 then add(walls,{ wx=x*8, wy=y*8, ww=8, wh=8, wsp=66 }) mset(x,y,64) end end end end --wall collision calculations function box_hit(x1,y1, w1,h1, x2,y2, w2,h2) local hit=false local xd=abs((x1+(w1/2))-(x2+w2/2)) local xs=w1/2+w2/2 local yd=abs((y1+(h1/2))-(y2+h2/2)) local ys=h1/2+h2/2 if xd &lt; xs and yd &lt; ys then hit=true end return hit end</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> https://www.lexaloffle.com/bbs/?tid=54494 https://www.lexaloffle.com/bbs/?tid=54494 Fri, 06 Oct 2023 23:45:28 UTC