--[[ a pressing problem. many of you have played various games in pico and have come across that one game with the dreaded btnp() function used instead of btn(). for action games like platformers or shooters, you should =never= use btnp() and i can think of a few shooters i've played that use btnp() making it difficult to maintain auto-fire and movement at the same time. what's the difference ? btn() reads a raw keystroke, it does not wait for key repeat and is perfect for action games. btnp() reads like a standard keyboard. it will allow one press, then nothing, then slowly repeat the stroke. so btn() is good for action games, and btnp() is better for thinking puzzle games. hope this helps ! ]]-- m=0 x=60 y=60 repeat cls() t="off" if (m==1) t="on" print("raw key="..t) print("press ❎ to swap") circfill(x,y,8) if ((btn(⬆️) and m==1) or btnp(⬆️)) y-=1 if ((btn(⬇️) and m==1) or btnp(⬇️)) y+=1 if ((btn(⬅️) and m==1) or btnp(⬅️)) x-=1 if ((btn(➡️) and m==1) or btnp(➡️)) x+=1 if (btnp(❎)) m=1-m flip() until forever |
Copy code to P8 and run to see for yourself ...
[Please log in to post a comment]