Solarus quests
1.6
Quest maker's reference
|
You can get information about the low-level keyboard and joypad inputs through sol.input
.
But remember that when a low-level keyboard or joypad input event occurs, all useful objects (sol.main, the game, map and menus) are already notified. For example, when the user presses a keyboard key, the engine automatically calls sol.main:on_key_pressed().
Also note that during the game, there exists the higher-level notion of game commands to ease your life.
Returns whether joypad support is enabled.
This may be true even without any joypad plugged.
true
if joypad support is enabled.Enables or disables joypad support.
Joypad support may be enabled even without any joypad plugged.
joypad_enabled
true
to enable joypad support, false to disable it. No value means true
.Returns whether a keyboard key is currently down.
key
(string): The name of a keyboard key.true
if this keyboard key is currently down.Returns the keyboard key modifiers currently active.
"shift"
, "control"
, "alt"
and "caps lock"
. Table values are true
.Returns whether a joypad button is currently down.
button
(number): Index of a button of the joypad.true
if this joypad button is currently down.Returns the current state of an axis of the joypad.
axis
(number): Index of a joypad axis. The first one is 0
.-1
means left or up, 0
means centered and 1
means right or down.Returns the current direction of a hat of the joypad.
hat
(number): Index of a joypad hat. The first one is 0
.-1
means that the hat is centered. 0
to 7
indicates that the hat is in one of the eight main directions.Returns the current position of the mouse cursor relative to the quest size.
If the mouse is outside the window, mouse coordinates are captured only if a mouse button is pressed. In this case, the returned values can be out of bounds of the quest size and can be negative. This allows you to keep track of the mouse movement when dragging something. Otherwise, when no mouse button is pressed, the returned coordinates are the last position of the mouse in the window.
x
position of the mouse in quest size coordinates.y
position of the mouse in quest size coordinates.Returns whether a mouse button is currently down.
button
(string): The name of a mouse button. Possible values are "left"
, "middle"
, "right"
, "x1"
and "x2"
.true
if mouse button is down.Returns the current position of a finger if it exists.
finger
(integer): The finger id to check.x
position of the finger in quest size coordinates. Return nil
if the finger does not exist or is not pressed.y
position of the finger in quest size coordinates.Returns the current pressure of a finger if it exists.
finger
(integer): The finger id to check.pressure
of the finger between 0.0
and 1.0
. Return nil
if there is no such finger.Returns whether a finger is currently pressed.
finger
(integer): The finger id to check.true
if the finger is down.Simulates pressing a keyboard key.
key
(string): The keyboard key to simulate.Simulates releasing a keyboard key.
key
(string): The keyboard key to simulate.