Nedim [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=49599 2D Cityscape generator <p> <table><tr><td> <a href="/bbs/?pid=154933#p"> <img src="/bbs/thumbs/pico64_city_gen-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=154933#p"> city_gen</a><br><br> by <a href="/bbs/?uid=49599"> Nedim</a> <br><br><br> <a href="/bbs/?pid=154933#p"> [Click to Play]</a> </td></tr></table> </p> <p>Press [Left arrow] to generate a new city</p> <p>Little project I started after getting into tables and all the functionality they provide. I'd love to eventually add an &quot;ocean&quot; that reflects the cityscape and distorts it a little.</p> https://www.lexaloffle.com/bbs/?tid=144460 https://www.lexaloffle.com/bbs/?tid=144460 Sat, 28 Sep 2024 06:06:41 UTC Ant <p> <table><tr><td> <a href="/bbs/?pid=154672#p"> <img src="/bbs/thumbs/pico64_ant-2.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=154672#p"> ant</a><br><br> by <a href="/bbs/?uid=49599"> Nedim</a> <br><br><br> <a href="/bbs/?pid=154672#p"> [Click to Play]</a> </td></tr></table> </p> <p>Ant algorithm</p> <p>UPDATE: You can now hold down [Left mouse button] to spawn ants at the cursor location</p> <p>Rules:<br /> -if pixel is black: move forward, then turn right<br /> -if pixel is white: move forward, then turn left<br /> -always swap color of current pixel</p> https://www.lexaloffle.com/bbs/?tid=144374 https://www.lexaloffle.com/bbs/?tid=144374 Mon, 23 Sep 2024 21:34:43 UTC Raycaster level editor <p> <table><tr><td> <a href="/bbs/?pid=153139#p"> <img src="/bbs/thumbs/pico64_tile_raycaster-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=153139#p"> tile_raycaster</a><br><br> by <a href="/bbs/?uid=49599"> Nedim</a> <br><br><br> <a href="/bbs/?pid=153139#p"> [Click to Play]</a> </td></tr></table> </p> <p>Demo I made of a very simple level editor for a 3D ray caster game.</p> <h2>CONTROLS:</h2> <p><strong>In map editor:</strong></p> <ul> <li>Arrows - move cursor</li> <li>Hold X + left/right arrows - pick tile</li> <li>Hold C + move cursor - paint tiles</li> <li>Once PLAYER tiles is selected, press C while holding X to spawn player on map</li> </ul> <p><strong>In first person mode:</strong></p> <ul> <li>Left/right arrows - look left right</li> <li>Up/down arrows - move forwards/backwards</li> </ul> <p>I originally started making this as a custom level maker for a first person shooter like DOOM or Wolfenstein 3D but I had to move on to other projects.</p> <p>You are welcome to make changes to my code and potentially add shooter functionality to this demo.</p> https://www.lexaloffle.com/bbs/?tid=143825 https://www.lexaloffle.com/bbs/?tid=143825 Fri, 23 Aug 2024 14:52:36 UTC 3D Raycaster help <p>I want to make my own raycaster game in picotron and I have been following <a href="https://yaky.dev/2022-11-30-dark-streets-1/">this</a> blog written for a pico-8 raycaster. I get an error when I run this and I am not sure what I should do to fix this issue. Help would be much appreciated.</p> <p>Other than the code, all I did is make a sprite in slot 1 and draw a simple map in the map editor.</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>function _init() cam={ x=12, y=12, a=0, w2d=2 } scrx=0 end function _update() controls() end function _draw() cls() map(0,0,0,0,16,16) circ(cam.x,cam.y,2,12) --for scrx=0,480 do -- raycast(cam,scrx) --end raycast(cam,240) end function controls() if btn(0) then cam.a+=0.01 end if btn(1) then cam.a-=0.01 end if btn(2) then cam.x+=cos(cam.a)*0.5 cam.y+=sin(cam.a)*0.5 end if btn(3) then cam.x+=cos(cam.a)*-0.25 cam.y*=sin(cam.a)*-0.25 end end function raycast(cam,scrx) local rayvx,rayvy= cam.vx-cam.vy*cam.w2d*(scrx-64)/128, cam.vy+cam.vx*cam.w2d*(scrx-64)/128 -- distance traveled local dist=0 -- current coordinates local x,y=cam.x,cam.y -- map cel coordinate and value local celx,cely=x8,y8 local cel=mget(celx,cely) -- direction of ray local dirx,diry= sgn(rayvx),sgn(rayvy) -- distances across map cel local dist4x,dist4y= abs(8/rayvx), abs(8/rayvy) -- distances to next map cel local dx,dy= abs(4+4*dirx-x%8), abs(4+4*diry-y%8) local dist2x,dist2y= abs(dx/rayvx), abs(dy/rayvy) -- which direction / angle -- the wall was hit from local hita=0 -- perform dda repeat if dist2x=64 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=142124 https://www.lexaloffle.com/bbs/?tid=142124 Mon, 06 May 2024 08:53:15 UTC Trouble reading mget() <p>I am trying to make a top down RPG in Picotron and I want to use a combination of mget() and fget() to make collision. I understand that fget is a bit weird in Picotron but mget is also acting strange as it only reads the sprite numbers of 4 sprites in a 2x2 formation on the 0,0 corner of my map.</p> <p>Is anyone else experiencing this or could this just be me being silly?</p> https://www.lexaloffle.com/bbs/?tid=141388 https://www.lexaloffle.com/bbs/?tid=141388 Tue, 02 Apr 2024 15:53:02 UTC Mouse map tile checker <p>I wrote a function that shows the mouse coordinates and sprite number of the map tile you are hovering over. I originally wrote this for myself to make checking the tiles on my map easier but figured I could share it in case anyone else finds it useful.</p> <img loading="lazy" style="margin-bottom:16px" border=0 src="/media/49599/Screenshot 2024-04-02 175613.png" alt="" /> <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>function debug_mouse() local mx,my = mouse() local x_offset=5 local y_offset=5 --window width and height local w=480 local h=270 --offset if box leaves screen if mx&gt;w-20 then x_offset=-15 end if my&gt;h-29 then y_offset=-24 end --draw debug text box rectfill(mx+x_offset-1,my+y_offset-1,mx+x_offset+14,my+y_offset+23,1) print(mx,mx+x_offset,my+y_offset,8) print(my,mx+x_offset,my+y_offset+8,9) print(mget(mx,my),mx+x_offset,my+y_offset+8*2,10) 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=141387 https://www.lexaloffle.com/bbs/?tid=141387 Tue, 02 Apr 2024 15:44:44 UTC