Birdstonelabs [Lexaloffle Blog Feed] A little help with tables <p>Hello there!</p> <p>I have been exploring Pico8 for over 2 years now trying to understand coding with let's say &quot;some&quot; progress.</p> <p>But I'm stuck with Tables. I mean, I get the concept but there's something I haven't got to fully understand therefore I get mixed results.</p> <p>So I created actors (player, enemy) as tables but I can't make them spawn several instances on screen. So far I have got to draw 5 enemies on stage (at random position) but they keep appearing all the time (where they should appear once), any light about what I'm doing wrong? here's the code:</p> <p>--init<br /> function _init()<br /> --globals<br /> wave=5<br /> w=112<br /> h=112</p> <p>--player<br /> pyr={<br /> spt=1,<br /> x=w/3,<br /> y=h/3,<br /> life=10,<br /> spd=2,<br /> flp=false,<br /> idle=true,<br /> }<br /> enms={} --enemies</p> <p>enm={ --single enemy</p> <p>spt=10,<br /> life=5,<br /> spd=1,<br /> flp=false,<br /> idle=true,<br /> draw=function()<br /> spr(enm.spt,flr(rnd(w)),flr(rnd(h)))<br /> end,<br /> }</p> <p>for a=1,wave do<br /> add(enms,enm)<br /> end</p> <p>end</p> <p>--draw<br /> function _draw()<br /> cls()<br /> print(#enms,20,20,7) --checking created instances from enms table<br /> foreach(enm,enm:draw())<br /> end</p> <hr /> <p>I have read tutorials, videos and everything available but still I haven't figured it out yet :( Any help is much appreciated.</p> Fri, 06 Mar 2020 21:40:02 UTC Learn code vs. game design: Overcoming frustration <p>So I'm just another old school gaming enthusiast who loves to make games for fun. I stumbled upon Pico-8 and I got so amazed by the concept that I decided to learn programming. I have made some mobile games before but I used Construct 2, which provides a set of widgets and tools to create a game with just a little knowledge of coding.</p> <p>However, after 2-3 weeks with P8 I got into to this situation where I'm wondering myself if I want to <strong>learn coding</strong> by making a tiny game or just want to <strong>have fun while making a tiny game</strong>.</p> <p>I'd love to say <strong>both</strong> but for me, it depends of how &quot;intuitive&quot; is to communicate with the hardware through a programming language (that's the reason why languages exist) but at this time it is not. There are a few things that should be easy but for some reason I just can't get to understand, like:</p> <ul> <li>Rotate a sprite by 90 degrees in order to recycle sprites on top view games instead of having 4 different animations for each direction</li> <li>Simple stuff like understanding how to handle arguments within functions or tables</li> </ul> <p><em>It's Worth to recall that I'm an absolute Noob on this matter and sometimes I feel that my brain is just not compatible with programming logic :(</em></p> <p>And yes, I have spent days trying to understand the amazing pieces of code from the community and I have learned a lot, but there are some little things that I havent't found anywhere on the web that could help me and other newbies like me to find a balance between designing a game through graphics and music, and making it work through coding. I have created this topic to share these &quot;silly and basic questions&quot; by non-programmers :)</p> Wed, 14 Mar 2018 14:42:40 UTC