RaspberryPye [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=41726 Best way to add to beginning of list <h3>Hi</h3> <p>Short question this time. What is the least-bloated way to insert a value into a list at the first index using add(). I couldnt figure out a method which is elegant and simple. </p> <h3>Thanks</h3> https://www.lexaloffle.com/bbs/?tid=38249 https://www.lexaloffle.com/bbs/?tid=38249 Tue, 02 Jun 2020 16:45:01 UTC Procedural generation of rooms <h3>Hi</h3> <p>I am making a roguelike and i would like to add in procedural generation of rooms. I would have prebuilt rooms in the map editor and when the character goes below, above, left or right of the current room, it would take them to a new room with which that entry was possible. I can do this ok apart from one thing:</p> <p>How do i store the layout of the rooms once you go into a new room? If it was just left and right i would make a list of the coordinates of the rooms and when the player goes to the right, a new random room would be appended at the end, if it is to the left then at the beginning. Though this doesn't work when i have up and down too. How do i store the coordinates of the rooms that the player has already been in is my question.</p> <p>I would appreciate some help</p> <h3>Thanks</h3> https://www.lexaloffle.com/bbs/?tid=38247 https://www.lexaloffle.com/bbs/?tid=38247 Tue, 02 Jun 2020 14:44:53 UTC Need help with cleaning code <h3>Hello again!</h3> <p>I am currently making an infinite dungeon crawler. I have finished he physics engine and basic combat with 3 enemy types. My code is garbage. It has hit 2200 tokens already and so much of the code is probably useless or could be written way better. This is a big ask but i would appreciate if someone could perhaps point out some areas where i could save some big tokens. Little things i will figure our later. And if youre feeling extra kind, my enemies invisibility frames are kinda broken and i cant figure out why, along with the character sometimes randomly falling into the floor because he is more than halfway down so the function which pops him to the next tile puts him on the lower one...</p> <h3>Thanks!</h3> <p> <table><tr><td> <a href="/bbs/?pid=77527#p"> <img src="/bbs/thumbs/pico8_toknight-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=77527#p"> toknight</a><br><br> by <a href="/bbs/?uid=41726"> RaspberryPye</a> <br><br><br> <a href="/bbs/?pid=77527#p"> [Click to Play]</a> </td></tr></table> </p> https://www.lexaloffle.com/bbs/?tid=38242 https://www.lexaloffle.com/bbs/?tid=38242 Tue, 02 Jun 2020 13:16:01 UTC Variable Jumping Heights <h2>Hello!</h2> <p>I am making a new metroidvania and i feel like a critical part of this is getting the jumping to feel right. I tinkered with it for a while before i realised that a true metroidvania really needs variable jumping, where the longer the button is pressed the higher you go. I have had some issues with implementing this and i would appreciate some help.</p> <p>Thanks!</p> https://www.lexaloffle.com/bbs/?tid=38223 https://www.lexaloffle.com/bbs/?tid=38223 Sun, 31 May 2020 08:24:51 UTC Entity Component Systems <h2>Hello again!</h2> <p>I had a peek into Celeste's code and i believe it is made using ECS or Entity Component systems. It gripped me immediately as i can sort-of understand the way it works, i think. I believe that each entity in a game contains its own update draw and init functions, and in the main update draw and init functions you just have a foreach loop that cycles through them and updates/draws them individually. My first question would be is this right? My second and main question is can anyone expand and put it into (preferably extremely simple) code. I would love to use this new architecture.</p> <h2>Thanks!</h2> https://www.lexaloffle.com/bbs/?tid=38154 https://www.lexaloffle.com/bbs/?tid=38154 Wed, 27 May 2020 07:22:48 UTC Particle effects for jumping <h2>Hello!</h2> <p>I am currently making a platformer and i have managed to program my own particle effects like wind and smoke (though they are probably far from optimised). Though i have been stumped with jumping. I would like to use pget() to get the colour of the tile below you so when you jump, little pieces of the same colour will fly up and then land in all directions. I would appreciate some help or perhaps some sample code for me to study. Thanks!</p> https://www.lexaloffle.com/bbs/?tid=38103 https://www.lexaloffle.com/bbs/?tid=38103 Sat, 23 May 2020 17:30:36 UTC Understanding OOP and Metatables in Lua <h2>Hello everyone!</h2> <p>I am having plenty of fun with pico8 but I feel as though i have gotten to the point where i can comfortably use lua to make a decent game. However, when i peek inside some big games like Celeste and Dank Tomb, it seems to chuck all i know out the window. I investigated and found out about metatables.</p> <p>My first question would be should i learn about them? Will it help me get to the next stage of pico8 programming?</p> <p>My second question is regarding an example of a 'simple' metatable:</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>-- meta class rectangle = {area = 0, length = 0, breadth = 0} -- derived class method new function rectangle:new (o,length,breadth) o = o or {} setmetatable(o, self) self.__index = self self.length = length or 0 self.breadth = breadth or 0 self.area = length*breadth; return o end -- derived class method printarea function rectangle:printarea () print(&quot;the area of rectangle is &quot;..self.area) end r=rectangle:new(nil,10,20) r:printarea()</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <p>I have no clue what anything here does, so would it be possible if someone could go through line by line and explain.</p> <p>Thanks a lot!<br /> (If the answer to question 1 is no, could you give some pointers as to where to find something that will help)</p> https://www.lexaloffle.com/bbs/?tid=38095 https://www.lexaloffle.com/bbs/?tid=38095 Sat, 23 May 2020 09:25:31 UTC Graph Plotter <h1>Graph plotter</h1> <h3>I've been working on this for a while now</h3> <p>This is my alpha-release of this software. I intend to further develop it so you can have multiple graphs at the same time and also the use of trigonometric graphs.</p> <h2>Enjoy!</h2> <p> <table><tr><td> <a href="/bbs/?pid=74138#p"> <img src="/bbs/thumbs/pico8_graphplotter-0.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=74138#p"> Graph Plotter 1.0</a><br><br> by <a href="/bbs/?uid=41726"> RaspberryPye</a> <br><br><br> <a href="/bbs/?pid=74138#p"> [Click to Play]</a> </td></tr></table> </p> https://www.lexaloffle.com/bbs/?tid=37203 https://www.lexaloffle.com/bbs/?tid=37203 Sun, 29 Mar 2020 10:55:55 UTC Graph Plotter 1.1 <p> <table><tr><td> <a href="/bbs/?pid=74138#p"> <img src="/bbs/thumbs/pico8_graphplotter-2.png" style="height:256px"></a> </td><td width=10></td><td valign=top> <a href="/bbs/?pid=74138#p"> Graph Plotter 1.1</a><br><br> by <a href="/bbs/?uid=41726"> RaspberryPye</a> <br><br><br> <a href="/bbs/?pid=74138#p"> [Click to Play]</a> </td></tr></table> </p> <h1>Graph Plotter</h1> <h3>Been working on this for a while! Hope you enjoy!</h3> <p>This is my first pico-8 project so I'm open to critical feedback!</p> <p>Version 1.1:</p> <p>-Removed polynomial setting to make way for big update ;)<br /> -Added ability to &quot;stamp&quot; current graph and then calculate the intersection of the two graphs (i.e. solve the simultaneous equations)<br /> -Bug fixes</p> https://www.lexaloffle.com/bbs/?tid=37127 https://www.lexaloffle.com/bbs/?tid=37127 Mon, 23 Mar 2020 11:45:01 UTC