Olivander12 [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=23675 Beginner's question about movement and &quot;modules&quot; <p>Hey guys, </p> <p>I am new to programming in general and started coding with the Pico-8 a few days ago. I did read/watch a lot of tutorials and got some small &quot;games&quot; already working. I want to take it slowly so that I understand what I am doing. My main goal is to program a simple jump'n'run game. </p> <p>Now my questions is: Is it possible to add certain things (modules) to my existing code (basic movement with walking animation) or do have to to re-code everything when things get more complicated? I am asking since I did two tutorials. The first one did movement like this (example for left button)</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> if(btn(0)) player.x-=player.speed </pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <p>Then I read another in the fanzine #2 where movement was done in a way I could not follow. The author used different states for walking, jumping and being idle. The whole thing was called &quot;finite state machine&quot;. </p> <p>Now I am unsure about two things: Does the first approach allow jumping, falling, etc or do I have to work with the states? Secondly, I would like to add things like particle effects or shooting bullets to my game. Can these (and other) modules (do not know if that's the correct expression) be simply added without having to re-code everything? </p> <p>Tl;dr: </p> <ol> <li> <p>Can things like jumping, falling etc. be added to the abovementioned example for movement? </p> </li> <li>Can modules like shooting bullets, particles, enemy ai etc. be simply added to the existing code or do they need a whole different &quot;frame&quot; each depending on how they work? </li> </ol> <p>I hope my questions are clear and they are not too nooby. Thanks in advance for your answers.</p> https://www.lexaloffle.com/bbs/?tid=29016 https://www.lexaloffle.com/bbs/?tid=29016 Tue, 21 Mar 2017 10:22:32 UTC