In my latest game, I rely on a press of both buttons to restore health. But players (including myself) have been complaining that this behaves inconsistently.
I am using code along the lines of:
if(btnp(4) and btnp(5))then plr.usepotion(plr); elseif(btnp(4))then if(plr.stm>1)then plr.commanddash(plr) plr.stm-=10 else sfx(18) end elseif(btnp(5)) then if(plr.stm>1)then plr.attack(plr) plr.stm-=5 else sfx(18) end end |
Its just too inconsistent though. I've had comments wishing there was a third button.
So the way that's written, they need to press X and O in the same frame to use a potion. If you do this instead...
if btn(🅾️) then if btnp(❎) then ... use potion code here ... end end |
..it will make it so they just have to press ❎ while they're holding 🅾️ to use a potion.
FYI you can now use ❎ and 🅾️ in code instead of 4/5. To type them in the pico-8 editor, hold shift when pressing X or O.
You may want to do something like this...
if btn(❎) and btnp(🅾️) then ... use potion code here ... elseif btn(❎) then ... attack code ... elseif btnp(🅾️) then ... dash code ... end |
that would make it so that you always attack when you first press the ❎ button. If you press 🅾️ without holding ❎, you'll dash. And if you press 🅾️ after you've started holding down ❎, you'll use a potion.
The other option would be to add a menu. There's a built-in pause menu ('P' on the keyboard) you can add things to using menuitem().
Ah thanks for your reply, that's great, never thought to check them one by one.
[Please log in to post a comment]