femto.input.Button - felipemanga/FemtoIDE GitHub Wiki
Summary
This class lets you answer the age-old question: "Is the player pressing button A?"
Utilization
Button contains static fields that correspond to each physical button on the Pokitto.
To check if a button is pressed, simply call isPressed
or 'justPressed' on the corresponding field:
import femto.input.Button;
if( Button.A.isPressed() ) gameOver();
This can also be shortened using a static import:
import static femto.input.Button.*;
if( B.isPressed() ) youWin();
The button names are: Up, Down, Left, Right, A, B, C, D (the flash button).
Methods
-boolean isPressed()
returns true while the player is pressing the button.
-boolean justPressed()
returns true just one time when the player pressed the button.