Log In  
Follow
zacharysandel
[ :: Read More :: ]

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#48059 2018-01-11 15:23 ( Edited 2018-01-11 20:49)

[ :: Read More :: ]

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.

My movement code is:

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

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.

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#37527 2017-02-16 17:10 ( Edited 2017-02-17 19:23)

Follow Lexaloffle:          
Generated 2024-03-29 01:07:20 | 0.061s | Q:6