zacharysandel [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=23239 Reload() above 0x4300? <p>Right now I'm under the assumption that it's not possible to reload data higher than 0x4300? I'm not the most competent person with pico-8, so I just thought I'd check.</p> https://www.lexaloffle.com/bbs/?tid=30591 https://www.lexaloffle.com/bbs/?tid=30591 Thu, 11 Jan 2018 15:23:55 UTC Prevent diagonal movement <p>I'm a novice programmer, and am fumbling my way through making a game in PICO-8. One of the things that I want to do in my movement code is only have 4 directional movement, not 8.</p> <p>My movement code is:</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 move_player() --walkleft if (btnp(0)) then px-=8 end --walkright if (btnp(1)) then px+=8 end --walkup if (btnp(2)) then py-=8 end --walkdown if (btnp(3)) then py+=8 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> <p>I use btnp because I want tile locked movement in my game. This might be achievable with btn, but I couldn't figure it out. One big problem with this is the lag from the initial press to when it moves again from holding the button down. Also, if you hold both up/right, up/left, down/right, or down/left on the arrow keys the player will move diagonally. This makes sense, of course, but it's not what I want.</p> <p>My problem is that I do not know how to achieve what I want. My first thought is something along the lines of only accepting the most recent button input, using elseif achieves something close, but directions take priority in the order they're written, not pressed. I'd appreciate any help. </p> https://www.lexaloffle.com/bbs/?tid=28840 https://www.lexaloffle.com/bbs/?tid=28840 Thu, 16 Feb 2017 17:10:12 UTC