ltpitt [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=22953 A little help on designing a counter... <p>Hi all!</p> <p>I would like to create a counter that goes from 0 seconds to 1 and vice versa, forever.</p> <p>I know that I can use time() and indeed I can successfully count from 0 to 1 but then.</p> <p>How can I decrease and increase again?</p> <p>I cannot picture a solution...</p> <p>Thanks! </p> https://www.lexaloffle.com/bbs/?tid=46153 https://www.lexaloffle.com/bbs/?tid=46153 Thu, 13 Jan 2022 18:14:17 UTC How can I implement nice fire rate for a shoot'em'up? <p>Hi all!</p> <p>I am trying to implement a very small and simple clone of space invaders.</p> <p>I am thinking how to implement a nice shoot bullet function but I am struggling with picturing a way to shoot bullets in a nice stream that is always steady so that its pace can be increased picking up right power-ups.</p> <p>I tried, for example, to count maximum number of bullets on screen and shoot only if &lt; than 5 but when the player shoots, clearly, all the bullets are shot almost at the same time.<br /> Then I thought about storing the bullet starting point and comparing it to the next bullet but since my ship goes also forward and back this way is also wrong...</p> <p>Can you please suggest me some idea to remove this nasty wall? :)</p> <p>Thanks for your kind help!</p> <p>Ps<br /> In case it can be helpful here's the code so far:<br /> <a href="https://raw.githubusercontent.com/ltpitt/lua-pico-8-invaders/master/pico-8-invaders.p8">https://raw.githubusercontent.com/ltpitt/lua-pico-8-invaders/master/pico-8-invaders.p8</a></p> https://www.lexaloffle.com/bbs/?tid=39956 https://www.lexaloffle.com/bbs/?tid=39956 Sun, 18 Oct 2020 22:06:37 UTC Can a PICO-8 Arcade be used in a bar / pub? <p>Hi all!</p> <p>I know that a MAME cabinet is illegal, even if no payment to play is required.</p> <p>What about setting up a cabinet with PICO-8?</p> <p>Would that be ok to let people in the pub enjoy a relaxing game now and then (clearly for free)?</p> <p>Thanks for your help.</p> https://www.lexaloffle.com/bbs/?tid=30694 https://www.lexaloffle.com/bbs/?tid=30694 Tue, 30 Jan 2018 09:19:44 UTC PICO-8 inspiration <p>Hi all!</p> <p>This is TOTALLY the game I'd dream to see on PICO-8 :D</p> <p><a href="https://www.facebook.com/GameSpot/videos/10160106707775436/?hc_ref=ARTifjU_DzSKfuidG2zxjTpIQAQhokdgi0bjfzyLOxqu8CKda1hb8dLbTGyJ-4YsAEg">https://www.facebook.com/GameSpot/videos/10160106707775436/?hc_ref=ARTifjU_DzSKfuidG2zxjTpIQAQhokdgi0bjfzyLOxqu8CKda1hb8dLbTGyJ-4YsAEg</a></p> https://www.lexaloffle.com/bbs/?tid=30661 https://www.lexaloffle.com/bbs/?tid=30661 Fri, 26 Jan 2018 05:42:19 UTC [Solved] Pong - Paddle movement jerkiness <p>Hi all!</p> <p>I am working on a small pong clone:<br /> <a href="https://www.lexaloffle.com/bbs/?tid=29815">https://www.lexaloffle.com/bbs/?tid=29815</a></p> <p>I am unable to solve the paddle movement jerkiness.</p> <p>It is working perfectly if I move 1px per time but, if I increase paddle speed, it becomes really...<br /> Bad.</p> <p>Any suggestions?</p> <p>Thanks for your time and patience :)</p> https://www.lexaloffle.com/bbs/?tid=29910 https://www.lexaloffle.com/bbs/?tid=29910 Sat, 09 Sep 2017 14:23:34 UTC How to dynamically draw walls <p>Hi all!</p> <p>I would like to build walls for a shoot'em'up and I know I can obtain the result with map.</p> <p>What I do not understand is how to make the drawing dynamic.</p> <p>For example I have the sprite 0 that contains my wall and I would like PICO-8 to draw walls on the side programmatically.</p> <p>What would be the best approach to do so?</p> <p>Thanks for your time and patience.</p> https://www.lexaloffle.com/bbs/?tid=29871 https://www.lexaloffle.com/bbs/?tid=29871 Thu, 31 Aug 2017 11:25:30 UTC How can I make this collision function working for circles and boxes? <p>Hi all!</p> <p>I have this collision function:</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 are_colliding(entity_a,entity_b) -- are entities hitting each others boundary and not the same type? return entity_b.x &lt; entity_a.x + entity_a.w and entity_a.x &lt; entity_b.x + entity_b.w and entity_b.y &lt; entity_a.y + entity_a.h and entity_a.y &lt; entity_b.y + entity_b.h 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>It works almost fine but it is not pixel perfect.</p> <p>I would like to use it in my games and make it as flexible as possible...<br /> For example an issue I am facing is that in my pong game I can have a round ball or squared ball, depending on theme &quot;classic&quot; or &quot;modern&quot;.<br /> This moves the &quot;x&quot; and &quot;y&quot; coordinates of the object I take into account and ruins the collision (here's the game in case it helps problem comprehension - collision is still done there &quot;manually&quot;):<br /> <a href="https://www.lexaloffle.com/bbs/?pid=43786#p43786">https://www.lexaloffle.com/bbs/?pid=43786#p43786</a></p> <p>Do you have a suggestion on how to make it as general as possible?</p> <p>Thanks for your time and patience :)</p> https://www.lexaloffle.com/bbs/?tid=29870 https://www.lexaloffle.com/bbs/?tid=29870 Thu, 31 Aug 2017 10:08:08 UTC Space Invaders <p> <table><tr><td> <a href="/bbs/?pid=43510#p"> <img src="/bbs/thumbs/pico43509.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=43510#p"> Space Invaders 0.1</a><br><br> by <a href="/bbs/?uid=22953"> ltpitt</a> <br><br><br> <a href="/bbs/?pid=43510#p"> [Click to Play]</a> </td></tr></table> <br /> I've just started a new game :)</p> https://www.lexaloffle.com/bbs/?tid=29825 https://www.lexaloffle.com/bbs/?tid=29825 Mon, 21 Aug 2017 08:41:47 UTC Pong-ino <p> <table><tr><td> <a href="/bbs/?pid=43430#p"> <img src="/bbs/thumbs/pico45043.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=43430#p"> Pong-ino 0.5</a><br><br> by <a href="/bbs/?uid=22953"> ltpitt</a> <br><br><br> <a href="/bbs/?pid=43430#p"> [Click to Play]</a> </td></tr></table> </p> <p> <table><tr><td> <a href="/bbs/?pid=43430#p"> <img src="/bbs/thumbs/pico44892.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=43430#p"> Pong-ino 0.4</a><br><br> by <a href="/bbs/?uid=22953"> ltpitt</a> <br><br><br> <a href="/bbs/?pid=43430#p"> [Click to Play]</a> </td></tr></table> </p> <p> <table><tr><td> <a href="/bbs/?pid=43430#p"> <img src="/bbs/thumbs/pico44161.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=43430#p"> Pong-ino 0.3</a><br><br> by <a href="/bbs/?uid=22953"> ltpitt</a> <br><br><br> <a href="/bbs/?pid=43430#p"> [Click to Play]</a> </td></tr></table> </p> <p> <table><tr><td> <a href="/bbs/?pid=43430#p"> <img src="/bbs/thumbs/pico44003.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=43430#p"> Pong-ino 0.2</a><br><br> by <a href="/bbs/?uid=22953"> ltpitt</a> <br><br><br> <a href="/bbs/?pid=43430#p"> [Click to Play]</a> </td></tr></table> </p> <p> <table><tr><td> <a href="/bbs/?pid=43430#p"> <img src="/bbs/thumbs/pico43429.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=43430#p"> Pong-ino 0.1</a><br><br> by <a href="/bbs/?uid=22953"> ltpitt</a> <br><br><br> <a href="/bbs/?pid=43430#p"> [Click to Play]</a> </td></tr></table> </p> <p>Hi all!</p> <p>I've (not) finished my first game.</p> <p>There are countless things to do and polish and I already have some great suggestions from the forum.</p> <p>I am publishing it to gather new ideas and suggestions but, above all, to simplify the life of anybody that wants to check the code / test the game.</p> <p>If you happen to play the game and leave a comment I'd be happy.</p> <p>Really thanks for your time and patience, it is very appreciated :)</p> <p>=== CHANGELOG ===</p> <ul> <li> <p>0.5<br /> Look at how fierce is Pongman on the main screen!<br /> Don't you feel...<br /> Ehm.<br /> No, that is not fear at all.<br /> We also now have some embrional difficulty setting, yay!</p> </li> <li> <p>0.4<br /> Finally I've had some time to add &quot;Options&quot; menu and improve the graphics a tiny bit :D<br /> I am gettin in touch with Pixelart, I terribly suck but I am having great fun in learning / researching and I've met cool people on the net. I wrote a devlog with details here: <a href="https://ltpitt.itch.io/pong-ino/devlog/11579/pong-ino-04-shows-off-a-complete-options-menu">https://ltpitt.itch.io/pong-ino/devlog/11579/pong-ino-04-shows-off-a-complete-options-menu</a></p> </li> <li> <p>0.3<br /> Pad movement jerkiness is gone!<br /> I am a very happy guy and I deeply thank solar and capnmarcy for putting me in the right direction:<br /> <a href="https://www.lexaloffle.com/bbs/?tid=29910">https://www.lexaloffle.com/bbs/?tid=29910</a><br /> And I bow to ultrabrite with his perfect code and comments.<br /> Now I need to understand if the same treatment can be applied to the ball movement.<br /> I've been playing some of the old Pong versions (Original Arcade, Game Gear, Nintendo DS, Gameboy...) and I tried (and I am still trying) to make the Classic mode in Pong-ino similar to the original feeling.<br /> In this version I've also modified SFX in Classic mode for this reason.<br /> Countless bugs were squashed, the main one was ball spawn always in the same direction.</p> </li> <li> <p>0.2<br /> Ouch, collision is a very hairy topic!<br /> I've implemented countless versions but whatever was working in Classic mode had problems in Modern mode and vice versa.<br /> This is because in Classic I'm using just rectancles for the paddles and ball too and in Modern using a circle for the ball.<br /> The problem was cause by the fact that &quot;X&quot; coordinate is in the center for the circle and top left for the rectangle.<br /> I've also reduced pad sizes, increased pad and ball speeds as suggested here in the forums.</p> </li> <li>0.1<br /> Completed the 1st working version of the game</li> </ul> <p>=== TODO LIST ===</p> <ul> <li>Find some solution for the ball movement jerkiness (try to apply paddle movement solution)</li> <li>Improve the angle calculation at bounce (make it wider when the ball hits the end of the pads)</li> <li>Make the classic mode as close as possible to the original</li> <li>Add some spice to the Modern mode (powerups, maybe?)</li> </ul> https://www.lexaloffle.com/bbs/?tid=29815 https://www.lexaloffle.com/bbs/?tid=29815 Sat, 19 Aug 2017 14:24:40 UTC Pong - Keep paddle in screen <p>Hi all!</p> <p>I've completed a very basic implementation of Pong.</p> <p>I would like to make it nicer adding a classic mode that looks and plays as close to the original as possible.</p> <p>To do so I'd need, for starters, to increase my paddles speed but when I do so the paddles end out of the screen.</p> <p>I cannot understand why, this is the code causing the issue, it is very simple:</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> -- check if pad goes out of the upper part of the screen if button_up and pad.y &gt; game.upper_bound then pad.y-=1 elseif button_up and pad.y &lt;= game.upper_bound then pad.y=game.upper_bound end -- check if paddle goes out of the bottom parte of the screen if button_down and pad.y + pad.h &lt; game.lower_bound then pad.y+=1 elseif button_down and pad.y + pad.h &gt; game.lower_bound then pad.y=game.lower_bound 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>If instead of using 1 I use 2 or more the paddles get out of bounds (or start shaking).</p> <p>In case you want to check the complete code you can find it here:<br /> <a href="https://www.lexaloffle.com/bbs/?tid=29815">https://www.lexaloffle.com/bbs/?tid=29815</a></p> https://www.lexaloffle.com/bbs/?tid=29814 https://www.lexaloffle.com/bbs/?tid=29814 Sat, 19 Aug 2017 13:48:37 UTC How to draw a game intro <p>Hi all!</p> <p>I have almost tears in my eyes thinking that I've almost completed a very basic and lame implementation of Pong.</p> <p>I'd need to draw a very simple intro screen (with game name and settings).</p> <p>I would like to make a big image (128x128) that will cover the whole screen.</p> <p>What is the suggested method for this?</p> <p>Thanks :)</p> https://www.lexaloffle.com/bbs/?tid=29685 https://www.lexaloffle.com/bbs/?tid=29685 Thu, 20 Jul 2017 08:11:12 UTC Suggestion to implement a shoot'em'up <p>Hi everyone,</p> <p>I am writing, for pure fun, a small shoot'em'up.<br /> I would like to do things the &quot;right way&quot;.</p> <p>What tutorials / readings do you suggest to implement main topics:<br /> ship movement / projectile &amp; enemy movement?</p> <p>I've already implemented a very basic version of movement simply adding to x or y if the player is pressing a button but then I thought...<br /> I need also acceleration in order to enable power ups...<br /> Same problem will be with enemy waves (acceleration, rotation, specular patterns).</p> <p>How should I proceed?</p> <p>Is there any book to read or tutorial or article about those topics?</p> <p>Really thanks :)</p> https://www.lexaloffle.com/bbs/?tid=29660 https://www.lexaloffle.com/bbs/?tid=29660 Sat, 15 Jul 2017 13:10:34 UTC How can I show Pico-8 buttons on Android browsers? <p>Hi everyone!</p> <p>I would like to be able to use my games from Android browser.</p> <p>I know that this is possible because I saw a few games doing it.</p> <p>I am using latest PICO-8 version but, if I export to html, this is not working:<br /> <a href="http://www.davidenastri.it/engioi">http://www.davidenastri.it/engioi</a></p> <p>Thanks for your time and help :)</p> https://www.lexaloffle.com/bbs/?tid=29659 https://www.lexaloffle.com/bbs/?tid=29659 Sat, 15 Jul 2017 12:37:03 UTC How to improve my game and/or code <p>Hi all!</p> <p>I am putting some time in improving my code and make my tiny game smooth and decently playable.</p> <p>The result I obtained is really far from this (bugs everywhere, the game is slow and boring, it accelerates and slows down without any apparent reason).</p> <p>Clearly there is a lot to do and a long path to walk but I'd love if you guys can share any suggestion like changes I need to implement, maths / physics / trigonometry I need to study.</p> <p>I am sorry if this question is very broad but I'd be incredibly happy to get even the tiniest hint.</p> <p>This is my current code:<br /> <a href="https://github.com/ltpitt/lua-pico-8-pong">https://github.com/ltpitt/lua-pico-8-pong</a></p> <p>A version of the game can be found online:<br /> <a href="http://www.davidenastri.it/pong">http://www.davidenastri.it/pong</a></p> <p>Thanks for your time and patience :)</p> https://www.lexaloffle.com/bbs/?tid=29120 https://www.lexaloffle.com/bbs/?tid=29120 Thu, 06 Apr 2017 16:06:09 UTC How to use music <p>Hello there,</p> <p>I am playing the music from a function called intro.<br /> This function is run in the update loop.<br /> When the game state is intro then intro is showed and this is the moment I'd like to hear some music.</p> <p>Problem is that the intro function is called every time the update loop restarts and therefore the music restarts everytime producing a choppy noise.</p> <p>How can I solve this issue?</p> <p>My code is available here:<br /> <a href="https://github.com/ltpitt/pico-8-pong/blob/master/pico-8-pong.p8">https://github.com/ltpitt/pico-8-pong/blob/master/pico-8-pong.p8</a></p> <p>Thanks for your time and help :)</p> https://www.lexaloffle.com/bbs/?tid=29071 https://www.lexaloffle.com/bbs/?tid=29071 Thu, 30 Mar 2017 07:38:13 UTC Simple delay issue <p>Hi everyone!</p> <p>I am building a small pong clone and I would like the game to pause for 2 or 3 seconds whenever a player is scoring.</p> <p>I saw that there are out there timer class but, since it was not easy for me to implement that, I wanted to ask if there is a simpler way to achieve this result.</p> <p>Thanks!</p> https://www.lexaloffle.com/bbs/?tid=29044 https://www.lexaloffle.com/bbs/?tid=29044 Fri, 24 Mar 2017 09:06:01 UTC Handle button bounce <p>Hi all!</p> <p>I am building a small pong clone for fun and I have an issue when I press the button to enable pause.</p> <p>Basically the pause is enabling / disabling itself really fast.</p> <p>This happens if I use btn() and also if I use btnp()...</p> <p>The source code is available here:<br /> <a href="https://github.com/ltpitt/pico-8-pong">https://github.com/ltpitt/pico-8-pong</a></p> <p>Can you please help?</p> <p>Thanks and happy hacking :)</p> https://www.lexaloffle.com/bbs/?tid=29021 https://www.lexaloffle.com/bbs/?tid=29021 Wed, 22 Mar 2017 10:00:19 UTC