dreternal [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=59786 Example of using &quot;objects&quot; in Pico-8 <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() cls() things = {} add_thing() end function _update() add_thing() for t in all(things) do t:update() end end function _draw() cls() for t in all(things) do t:draw() end end function add_thing() add( things, { my_color=rnd(16)-1, x=rnd(128), y=rnd(128), dx=rnd(2)-1, dy=rnd(2)-1, life=160, prevx=63, prevy=63, draw=function(self) pset(self.x, self.y, self.my_color) end, update=function(self) if (self.sprite_num == 1) then self.sprite_num = 2 else self.sprite_num = 1 end self.prevx=x self.prevy=y self.x += self.dx self.y += self.dy self.life-=1 if(self.life&lt;0) then del(bullet,self) end 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> https://www.lexaloffle.com/bbs/?tid=45563 https://www.lexaloffle.com/bbs/?tid=45563 Sat, 04 Dec 2021 15:24:19 UTC