JunoNgx [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=44203 Wonyun Trench Run <p> <table><tr><td> <a href="/bbs/?pid=78124#p"> <img src="/bbs/thumbs/pico8_wonyuntrenchrun-3.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=78124#p"> wonyuntrenchrun</a><br><br> by <a href="/bbs/?uid=44203"> JunoNgx</a> <br><br><br> <a href="/bbs/?pid=78124#p"> [Click to Play]</a> </td></tr></table> </p> <p>Here's my first game on Pico-8 :D</p> <p>While I am no stranger to gamedev, this is the first time I work on Pico-8. This is also an emotional moment for me, because I finally get to complete a project I started 6 years ago. This is also the very first time, as unbelievable as it is, I have genuinely enjoyed playing my game and thinking as an audience :D</p> <p>Instructions are all in the game, I'd like to see how I have improved my tutorial skill. Let me know if you have any problem.</p> <p>(Remember, press P/Enter (default Pico-8 keybind) to access the pause menu.)</p> <p>If you are keen for poke around and/or learning, I thoroughly wrote this game to be readable and the codebase is moderately commented and <a href="https://github.com/JunoNgx/p8wonyun">put it on GitHub</a>. This game implements an entity component system, not the usual standard object-oriented approach; let me know if I did it right. I have also created <a href="https://github.com/JunoNgx/p8-template">a boilerplate</a> implementing these in case you'd like to use some of them. Code critiques and feedback are highly appreciated :D</p> <p>I have also learned a massively lot and fixed an insanity-inducing bug caused by the max integer value of 32767 hours before launch :D</p> <p>Update 2020 Jun 16: Remapped keys.<br /> Update 2020 Jun 17: Fixed an incorrectly mapped key in caption state.<br /> Update 2020 Jun 21: Minor refactoring and change in draw layer with no remarkable impact on the game.</p> https://www.lexaloffle.com/bbs/?tid=38434 https://www.lexaloffle.com/bbs/?tid=38434 Mon, 15 Jun 2020 17:15:20 UTC How to iterate through functions in a table? <p>Hi,</p> <p>I'm trying to implement a simple Component Entity System. The amount of systems (which are actually functions) is getting bigger, and I'm putting them in a table to iterate over to avoid implementing back and forth.</p> <p>However, my iterator function using <code>all(t)</code> does not work at all.</p> <p>Here's the structure of my systems:</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>updatesystems = { system1 = function(t) [...] end, system2 = function(t) [...] end, system3 = function(t) [...] end, system4 = function(t) [...] 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><code>t</code> is a table which includes raw data of all entities.</p> <p>This is my current codes, which work:</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 _update() updatesystems.system1(world) updatesystems.system2(world) updatesystems.system3(world) updatesystems.system4(world) 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>What I would like to do</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 _update() for system in all(updatesystems) do system(world) 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> <p>And I have no idea why it doesn't work. None of the systems updates.</p> <p>Any suggestion?</p> https://www.lexaloffle.com/bbs/?tid=37945 https://www.lexaloffle.com/bbs/?tid=37945 Thu, 14 May 2020 10:41:57 UTC