samhocevar [Lexaloffle Blog Feed] Calculator <p> <table><tr><td> <a href="/bbs/?pid=59724#p"> <img src="/bbs/thumbs/pico8_calculator-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=59724#p"> calculator</a><br><br> by <a href="/bbs/?uid=14958"> samhocevar</a> <br><br><br> <a href="/bbs/?pid=59724#p"> [Click to Play]</a> </td></tr></table> </p> <p>Just a work in progress. The parser is not perfect but it needs a lot of work.</p> Wed, 05 Dec 2018 19:01:29 UTC Trouble parsing &quot;\\&quot; <p>This code does not work (<strong>unexpected symbol near 'then'</strong>):<br /> <span style=" display:inline-block; background-color:#eee; padding:2px; margin: 4px; padding-left: 8px; padding-right: 8px; color:#222">if (x == &quot;\\&quot;) then print(x) end</p> <p>But this works OK:<br /> <span style=" display:inline-block; background-color:#eee; padding:2px; margin: 4px; padding-left: 8px; padding-right: 8px; color:#222">bs = &quot;\\&quot; if (x == bs) then print(x) end</p> Wed, 05 Dec 2018 14:31:48 UTC Rainbow Cats [LD43] <p> <table><tr><td> <a href="/bbs/?pid=59669#p"> <img src="/bbs/thumbs/pico8_rainbow_cats-2.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=59669#p"> Rainbow Cats [LD43]</a><br><br> by <a href="/bbs/?uid=14958"> samhocevar</a> <br><br><br> <a href="/bbs/?pid=59669#p"> [Click to Play]</a> </td></tr></table> </p> <p>Your kittens are in danger! How could they survive in such a crazy world?</p> <p>You must return them home safely. Select the color of the kittens you wish to call and they will follow you everywhere.</p> <p>Controls:</p> <ul> <li>Navigation and player controls: arrows</li> <li>Call your kittens: X</li> <li>Validation and jump: Z or W</li> </ul> <p>This is the entry for Ludum Dare 43 we made with <a href=""> @Niarkou</a>.</p> <ul> <li><a href="">Ludum Dare 43 entry page</a></li> <li><a href="">Source code on GitHub</a></li> </ul> Tue, 04 Dec 2018 13:08:01 UTC Vanity <p> <table><tr><td> <a href="/bbs/?pid=59086#p"> <img src="/bbs/thumbs/pico59084.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=59086#p"> Vanity</a><br><br> by <a href="/bbs/?uid=14958"> samhocevar</a> <br><br><br> <a href="/bbs/?pid=59086#p"> [Click to Play]</a> </td></tr></table> <br /> This is my entry for #TweetTweetJam: an unfinished shooter, in about 530 characters of code.</p> <p>Left/right to move, X to shoot.</p> <p>It has music and SFX and many things but no actual gameplay.</p> <p>Jam entry page: <a href=""></a></p> Fri, 16 Nov 2018 18:06:44 UTC Hidden feature: splash screen <p>I noticed that if there is a file named &quot;splash.png&quot; in PICO-8�s directory, it will be displayed at launch before the boot sequence. This also works with cartridges exported as binary.</p> Thu, 16 Aug 2018 04:20:00 UTC Cat Lady Simulator: LD42 <p> <table><tr><td> <a href="/bbs/?pid=55104#p"> <img src="/bbs/thumbs/pico55138.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=55104#p"> Cat Lady Simulator: LD42</a><br><br> by <a href="/bbs/?uid=14958"> samhocevar</a> <br><br><br> <a href="/bbs/?pid=55104#p"> [Click to Play]</a> </td></tr></table> </p> <p>My love Niarkou and I made this for Ludum Dare in 72 hours!</p> <p><em>Objectives:</em> Feed your cats by filling their bowls. The more they eat, the more points you get! But too many cats and you will run out of space.</p> <p><em>Controls:</em></p> <ul> <li>Pause: P or Enter</li> <li>Navigation / Player controls: &#9664; &#9650;&#9660; &#9654;</li> <li>Menu validation / Take something / Pour something into the bowl: W / Z</li> <li>Throw away something: X</li> </ul> <p>LDJam link: <a href=""></a></p> Mon, 13 Aug 2018 19:47:17 UTC z8lua: an almost PICO-8 compatible Lua fork <p>I was working on this a while ago and haven�t found much time for it lately, but I thought it could be interesting to some people. It is a fork of Lua that implements the PICO-8 dialect.</p> <p><strong>Why?</strong></p> <p>If you know how to embed Lua somewhere, then there are chances that you can embed PICO-8 compatible Lua instead! I use it for an unfinished toy emulator project.</p> <p><strong>Features</strong></p> <ul> <li>short <em>if</em> syntax (on one line)</li> <li>short print syntax (<em>?</em> at the beginning of a line)</li> <li>compound assignment operators: <em>+=</em> <em>/=</em> etc.</li> <li>C style not equal operator: <em>!=</em></li> <li>C++ style comments with <em>//</em></li> <li>fixed-point arithmetic with overflows, infinity etc.</li> <li>the PICO-8 math library (<em>shr</em>, <em>atan2</em>, <em>flr</em> etc.)</li> <li>binary literals: <em>0b1001001.10010</em></li> <li>works in Windows and Linux, and probably in OS X too</li> </ul> <p><strong>How?</strong></p> <p>The usual approach to the language extensions is through code parsing and patching. For instance, replacing all occurrences of <em>&lt;something&gt;+=&lt;blah&gt;</em> with <em>&lt;something&gt;=&lt;something&gt;+(&lt;blah&gt;)</em>. This is what PICO-8 itself does, which is why it still has the occasional weird parsing issues (you can write <em>x=0y=1</em> but not <em>x+=0y=1</em>). My approach is to implement these extensions in the Lua parser instead, which is elegant, more robust, and gives better error reporting.</p> <p><strong>Where?</strong></p> <p>It�s on GitHub: <a href=""></a></p> <p><strong>Example</strong></p> <p>Here is a z8lua session in my terminal; you can see familiar PICO-8 syntax in here:</p> <img style="" border=0 src="" width=562 height=549 alt="" /> Mon, 30 Jul 2018 07:38:01 UTC Anthrax (inspired by Pang) <p> <table><tr><td> <a href="/bbs/?pid=54522#p"> <img src="/bbs/thumbs/pico54521.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=54522#p"> Anthrax (inspired by Pang)</a><br><br> by <a href="/bbs/?uid=14958"> samhocevar</a> <br><br><br> <a href="/bbs/?pid=54522#p"> [Click to Play]</a> </td></tr></table> We made this game over the weekend as some practice for Ludum Dare. It is named after one of our cats.</p> <p>Controls: left/right to move, X to fire.</p> Sun, 29 Jul 2018 17:18:47 UTC Agony Demake Demo <p> <table><tr><td> <a href="/bbs/?pid=47451#p"> <img src="/bbs/thumbs/pico47450.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=47451#p"> Agony Demake Demo</a><br><br> by <a href="/bbs/?uid=14958"> samhocevar</a> <br><br><br> <a href="/bbs/?pid=47451#p"> [Click to Play]</a> </td></tr></table> <br /> I was working on this during Ludum Dare 39 (4 months ago) but never got the courage to finish it� maybe one day!</p> Sat, 16 Dec 2017 17:17:15 UTC Kabloo8 (LD40 Jam) <p> <table><tr><td> <a href="/bbs/?pid=46977#p"> <img src="/bbs/thumbs/pico46976.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=46977#p"> Kabloo8</a><br><br> by <a href="/bbs/?uid=14958"> samhocevar</a> <br><br><br> <a href="/bbs/?pid=46977#p"> [Click to Play]</a> </td></tr></table> </p> <p>Made for Ludum Dare. It�s 2 minutes before the deadline, I need some sleep now.</p> Sun, 03 Dec 2017 20:59:27 UTC The Chamber Scrolls [LD37] <p> <table><tr><td> <a href="/bbs/?pid=33420#p"> <img src="/bbs/thumbs/pico33419.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=33420#p"> The Chamber Scrolls</a><br><br> by <a href="/bbs/?uid=14958"> samhocevar</a> <br><br><br> <a href="/bbs/?pid=33420#p"> [Click to Play]</a> </td></tr></table> </p> <p>A mini adventure game.</p> <p>This cartridge extensively abuses Lua memory, lossy zlib compression, data-stored-in-code, and dget to render a 600&times;252 image with pixel-perfect scrolling. This is more a tech demo but I ended up doing a full mini game for Ludum Dare 37.</p> <p>I�ll write a postmortem to explain all the hacks.</p> Mon, 12 Dec 2016 22:29:27 UTC Textmode colour screenshots <p>This function abuses Unicode and ANSI color codes to output a screenshot of the current screen to a text terminal such as xterm. You can record the PICO-8 rendering and replay it using �cat�! You can run PICO-8 over ssh! You can be anything you want.</p> <p>I also set up a telnet service demonstrating the feature:</p> <pre><span style=" display:inline-block; background-color:#eee; padding:2px; margin: 4px; padding-left: 8px; padding-right: 8px; color:#222">telnet 12345</pre> <p>Here is how it looks like; this is PICO-8 (small window) launched from GNOME Terminal (large window) just after screenshot() was called:</p> <p><a href=""><img style="" border=0 src="" width=420 height=262.5 alt="" /></a></p> <p>And here is the code:</p> <div> <div style="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> pico-8 cartridge // version 8 __lua__ -- screenshot to console -- by sam hocevar function screenshot() local l={ 16, 17, 89, 29, 131, 240, 251, 230, 197, 214, 220, 47, 39, 103, 211, 223 } local e=&quot;\027[&quot; printh(e..&quot;?25l&quot;) -- hide cursor for y=0,63 do local ofg,obg=-1,-1 local s=e..(y+1)..&quot;;1\072&quot; -- uppercase h for x=0,127 do fg,bg,ch=pget(x,y*2),pget(x,y*2+1),&quot;\226\150\128&quot; if bg&gt;fg then fg,bg,ch=bg,fg,&quot;\226\150\132&quot; end if fg!=ofg or bg!=obg then s=s..e local t=&quot;&quot; if (bg!=obg) s,t=s..&quot;48;5;&quot;..l[bg+1],&quot;;&quot; if (fg!=ofg) s=s..t..&quot;38;5;&quot;..l[fg+1] s=s..&quot;m&quot; end ofg,obg=fg,bg end printh(s..e..&quot;0m&quot;..e..&quot;\075&quot;) -- uppercase k end printh(e..&quot;?25h&quot;) -- show cursor end </pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <p>The terminal must be UTF-8 and 256-color aware, so this will probably work in most Linux and OS X terminals. On Windows I could test it successfully with the MSYS2 terminal.</p> Thu, 29 Sep 2016 08:15:16 UTC King Tut (hi-color demo) <p> <table><tr><td> <a href="/bbs/?pid=27685#p"> <img src="/bbs/thumbs/pico27684.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=27685#p"> King Tut</a><br><br> by <a href="/bbs/?uid=14958"> samhocevar</a> <br><br><br> <a href="/bbs/?pid=27685#p"> [Click to Play]</a> </td></tr></table> </p> <p>Will not work well on slow machines or in the web player.</p> <p>I�m toying with both hi-color images (using 60Hz flickering) and data compression, this is my first attempt. The image size is 128&times;188.</p> <p>The picture is of course a tribute to the Deluxe Paint series!</p> Mon, 29 Aug 2016 20:26:55 UTC