Solarus quests
1.6
Quest maker's reference
|
This module provides a datatype "game" that represents a savegame.
On a game object, you can access and modify everything that is saved. The data saved and restored by the engine are the following:
When a game is running, more features are available (like pausing the game, handling game commands, etc.). Only one game can be running at a time.
An important concept that comes with the game is the notion of game commands. Game commands are built-in game actions that can be mapped to a low-level keyboard or joypad input. They can be seen as an abstraction of the keyboard and the joypad. Game commands are like a virtual game device that provides the the following buttons:
"action"
: Contextual action such as talking, swimming, throwing, etc."attack"
: Main attack (using the sword)."pause"
: Pausing or unpausing the game."item_1"
: Using the equipment item placed in slot 1 (see game:get_item_assigned())"item_2"
: Using the equipment item placed in slot 2 (see game:get_item_assigned())"right"
: Moving to the right."left"
: Moving to the left."up"
: Moving to the top."down"
: Moving to the bottom.Of course, these virtual commands are mapped to real, low-level inputs from the keyboard and/or the joypad. You script can control which keyboard and joypad inputs are associated to each game command.
When a game command is pressed, no matter if the command came from the keyboard or the joypad, the engine performs some built-in behavior by default (like pausing the game or moving the hero to the right). But you can also extend or override this behavior, because the engine notifies you first (see game:on_command_pressed()). Therefore, you usually don't have to worry about the underlying keyboard or joypad input (but if you want to, you can, and the callbacks are exactly the sames as in sol.main and in menus).
Objects of the game type are userdata, but like most Solarus Lua types, they can also be accessed like tables. This is especially useful for the game type to add, next to the built-in game features, your own quest-specific functions and data (like your HUD and your pause menu).
Returns whether the specified savegame file exists.
A valid quest write directory must be set (in your quest.dat file or by calling sol.main.set_quest_write_dir()), otherwise savegames cannot be used and this function generates a Lua error.
file_name
(string): Name of the file to test, relative to the quest write directory.true
if there exists a file with this name in the quest write directory.Deletes a savegame file.
A valid quest write directory must be set (in your quest.dat file or by calling sol.main.set_quest_write_dir()), otherwise savegames cannot be used and this function generates a Lua error.
file_name
(string): Name of the file to delete, relative to the quest write directory.Loads an existing savegame, or initializes a new one if it does not exist (but does not save it).
A valid quest write directory must be set (in your quest.dat file or by calling sol.main.set_quest_write_dir()), otherwise savegames cannot be used and this function generates a Lua error.
file_name
(string): Name of a savegame file, relative to the to the quest write directory.Saves this game into its savegame file.
A valid quest write directory must be set (in your quest.dat file or by calling sol.main.set_quest_write_dir()), otherwise savegames cannot be used and this function generates a Lua error.
Runs this game.
This function is typically called from your savegame menu, when the player chooses its savegame file.
If another game was running, it is stopped automatically because only one game can be running at a time.
You can also call this function to restart the current game itself, even if it was not saved recently (saved data will not be reset). This may be useful to restart the game after the game-over sequence.
Returns whether this game is currently running.
Only one game can be running at a time.
true
if this game is running.Returns whether this game is currently suspended.
The game is suspended when at least one of the following conditions is true:
true
if this game is currently suspended. Only possible when the game is running.Suspends or unsuspends the game.
Note that the game is also automatically suspended by the engine in the following situations:
Therefore, if you call game:set_suspended(false)
during one of these sequences, it will only take effect at the end of it.
suspended
(boolean, optional): true
to suspend the game, false
to resume it. No value means true
.Returns whether this game is currently paused.
true
if this game is paused. Only possible when the game is running.Pauses or resumes the game explictly.
Note that by default, a built-in game command already exists to pause and unpause the game.
paused
(boolean, optional): true
to pause the game, false
to unpause it. Only possible when the game is running. No value means true
.Returns whether the player can pause or unpause the game.
true
if the player is allowed to pause the game.Sets whether the player can pause or unpause the game.
pause_allowed
(boolean, optional): true
to allow the player to pause the game. No value means true
.Returns whether this game is currently showing a dialog.
It does not matter whether the dialog is shown with the built-in, minimal dialog box or with your custom dialog box (see game:on_dialog_started()).
Only possible when the game is running.
true
if a dialog is being shown.Starts showing a dialog.
A dialog must not be already active. This function returns immediately, but you can provide a callback that will be executed when the dialog finishes. The game is suspended during the dialog, like when it is paused.
If the event game:on_dialog_started() is not defined, then the engine will show a default, minimal dialog system without decoration. The user will be able to close the dialog by pressing the action command (you don't need to call game:stop_dialog()).
On the contrary, if the event game:on_dialog_started() is defined, the engine calls it and does nothing else. This is the recommended way, because you can make your custom dialog box implementation with any feature you need. The game will be suspended until you call game:stop_dialog() explicitly.
dialog_id
(string): Id of the dialog to show. The corresponding dialog must exist in the dialogs.dat file of the current language.info
(any type, optional): Any information you want to pass to the game:on_dialog_started() event. You can use this parameter to include in the dialog any information that is only known at runtime, for example the name of the player, the best score of a mini-game or the time spent so far in the game. See the examples below.callback
(function, optional): A function to be called when the dialog finishes. A status parameter (possibly nil
) is passed to your function: its value is the argument of game:stop_dialog() and it represents the result of the dialog. This feature may be used by your dialog box system to return any useful information to the map script, like the answer chosen by the player if the dialog was a question, or whether the dialog was skipped.Example of a small map script with an NPC that shows a simple dialog:
local map = ... function some_npc:on_interaction() -- Remember that you specify a dialog id, not directly the text to show. -- The text is defined in the dialogs.dat file of the current language. map:get_game():start_dialog("welcome_to_my_house") end
Here is a more complex example, with an NPC that asks a question. This example assumes that your dialog box system can ask questions to the player, and returns the answer as a boolean value passed to game:stop_dialog().
local map = ... local game = map:get_game() function another_npc:on_interaction() game:start_dialog("give_me_100_rupees_please", function(answer) if answer then if game:get_money() >= 100 then game:remove_money(100) game:start_dialog("thanks") else sol.audio.play_sound("wrong") game:start_dialog("not_enough_money") end else game:start_dialog("not_happy") end end) end
Finally, to illustrate the use of the info
parameter, let's modify the previous example to make the amount of money only determined at runtime. In other words, we want an NPC that can say "Please give me 100 rupees", but also "Please give me 25 rupees" or any number. Since the number is only known at runtime, it can no longer be hardcoded in the text of the dialog. So let's assume that the text of the dialog contains instead a special sequence (like "$v"
) to be substituted by the final value. (Note that shop treasures use a very similar convention for their dialogs.)
local map = ... local game = map:get_game() function another_npc:on_interaction() local how_much = math.random(100) game:start_dialog("give_me_x_rupees_please", how_much, function(answer) if answer then if game:get_money() >= how_much then game:remove_money(how_much) -- ... The rest is unchanged.
To make this example work, you need a dialog box system that performs the substitution when info
is set. See game:on_dialog_started().
info
parameter of game:start_dialog() and the status parameter of the callback are a flexible way to make the map script communicate with the dialog box system in both directions. They can been seen as the parameter and the result (respectively) of the dialog being displayed. They can both be any value, like a table with many information.Stops the current dialog.
A dialog must be active when you call this function. The dialog stops being displayed and the game can resume. This function is typically called by your dialog box system when it wants to close the dialog.
The game:on_dialog_finished() event is first called (if it is defined). Then, the callback that was passed to game:start_dialog() is called (if it was defined) with the status
argument.
status
(any type, optional): Some information to return to the script that started the dialog. For example, you can pass the result of the dialog if it was a question, or whether it was skipped by the user before the end. See the examples above.Returns whether this game is currently showing a game-over sequence.
Only possible when the game is running.
The game-over sequence automatically starts when the player's life gets to zero, or when you call game:start_game_over() explicitly. Define the event game:on_game_over_started() to show your game-over menu. If you don't define this event, by default, there is no game-over sequence and the engine immediately restarts the game (but does not save it).
true
if a game-over sequence is running.Starts the game-over sequence manually.
Only possible when the game is running.
This function is seldom needed since the game-over sequence automatically starts when the player's life reaches zero. But you can use it if you want to start a game-over sequence even when the player's life is greater than zero.
Finishes the current game-over sequence.
Only possible during a game-over sequence.
The game is suspended during the whole game-over sequence. Call this function to resume it. If the life is still zero at this point, then the engine automatically restores full life.
Returns the current map.
nil
if this game is not running).Returns the hero.
The hero is a map entity that always exists while the game is running, and that persists when the map changes. For this reason, he can be seen as belonging to the game more than to the current map. That's why this function exists.
nil
if the game is not running.game:get_map():get_entity("hero")
.Returns a value saved.
savegame_variable
(string): Name of the value to get from the savegame.nil
if no value is defined with this key).Sets a value in the savegame.
This function allows to store key-value pairs in the savegame. Values can be strings, integers or booleans.
savegame_variable
(string): Name of the value to save (must contain alphanumeric characters or '_'
only, and must start with a letter).value
(string, number or boolean): The value to set, or nil
to unset this value.Returns the location where the hero is placed when this game is started or restarted.
nil
means that it was not set: in this case, the first map declared in project_db.dat will be used.nil
means that it was not set: in this case, the default destination entity of that map will be used.Sets the location where the hero should be placed when this game is started or restarted.
map_id
(string, optional): Id of the starting map. By default, the first map declared in project_db.dat is used.destination_name
(string, optional): Name of the destination where the hero should be placed on that map. By default, the default destination of the map is used.Returns the style of transition to use by default when changing maps.
This transition style is used when the game starts, when the game ends, and when calling hero:teleport() without specifying the style of transition.
"immediate"
: No transition effect."fade"
: Fade-out and fade-in effect (default)."scrolling"
: Scrolling between adjacent maps.Sets the style of transition to use by default when changing maps.
This transition style is used when the game starts, when the game ends, and when calling hero:teleport() without specifying the style of transition.
Returns the current level of life of the player.
Sets the level of life of the player.
A negative value will be replaced by zero. A value greater than than the maximum level of life will be replaced by the maximum value.
life
(number): Number of life points to set.Adds some life to the player.
life
(number): Number of life points to add. Must be a positive number or 0
.game:set_life(game:get_life() + life)
.Removes some life from the player.
life
(number): Number of life points to remove. Must be a positive number or 0
.game:set_life(game:get_life() - life)
.Returns the maximum level of life of the player.
Sets the maximum level of life of the player.
life
(number): Maximum number of life points to set. Must be a positive number.Increases the maximum level of life of the player.
life
(number): Maximum number of life points to add to the maximum. Must be a positive number or 0
.game:set_max_life(game:get_max_life() + life)
.Returns the amount of money of the player.
Sets the amount of money of the player.
A negative value will be replaced by zero. A value greater than than the maximum amount of money will be replaced by the maximum amount.
money
(number): The amount of money to set.Adds some money to the player.
money
(number): Amount of money to add. Must be a positive number or 0
.game:set_money(game:get_money() + money)
.Removes some money from the player.
money
(number): Amount of money to remove. Must be a positive number or 0
.game:set_money(game:get_money() - money)
.Returns the maximum amount of money of the player.
Sets the maximum amount of money of the player.
money
(number): Maximum money to set. Must be a positive number or 0
.Returns the current number of magic points.
Sets the amount of magic points of the player.
A negative value will be replaced by zero. A value greater than than the maximum number of magic points will be replaced by that maximum.
magic
(number): The number of magic points to set.Adds some magic points to the player.
magic
(number): Number of magic points to add. Must be a positive number or 0
.game:set_magic(game:get_magic() + magic)
.Removes some magic points from the player.
magic
(number): Number of magic points to remove. Must be a positive number or 0
.game:set_magic(game:get_magic() - magic)
.Returns the maximum number of magic points.
Sets the maximum number of magic points.
magic
(number): The maximum number of magic points to set. Must be a positive number or 0
.Returns whether the player has a built-in ability.
ability_name:
Name of the ability to get (see game:get_ability() for the list of valid ability names).true
if the player has this ability.game:get_ability(ability_name) > 0
.Returns the level of a built-in ability.
Built-in ability levels indicate whether the hero can perform some built-in actions like attacking, swimming or running. The initial value is 0
unless specified otherwise.
ability_name
(string): Name of the ability to get. Valid ability names are:"sword"
: Using the sword when pressing the attack command. Determines the default sword sprite."sword_knowledge"
: Ability to make the super spin-attack."tunic"
: Resistance level that reduces the damage received by the hero. Determines the default sprite used for the hero's body. The initial value is 1
."shield"
: Protection against enemies. Allows to avoid some attacks. Determines the default shield sprite."lift"
: Ability to lift other entities."swim"
: Ability to swim in deep water."jump_over_water"
: Automatically jumping when arriving into water without the "swim"
ability."run"
: Running when pressing the action command."push"
: Trying to push when walking towards an obstacle. The initial value is 1
."grab"
: Grabbing the faced obstacle when pressing the action command. The initial value is 1
."pull"
: Pulling the faced obstacle the hero is grabbing. The initial value is 1
."detect_weak_walls"
: Notifying the player with a sound when a weak wall is nearby.0
means not having this ability yet).Sets the level of an ability.
ability_name
(string): Name of the ability to set (see game:get_ability() for the list of valid ability names).level
(number): Level of this ability to set (0
removes the ability).Returns an equipment item.
item_name
(string): Name of the item to get.Returns whether the player has the specified equipment item (only for a saved item).
item_name
(string): Name of the item to check.true
if the player has at least the first variant of this item.game:get_item(item_name):get_variant() > 0
.Returns the equipment item assigned to a slot.
slot
(number): The slot to get (1
or 2
).nil
means none).Assigns an equipment item to a slot.
slot
(number): The slot to set (1
or 2
).item
(item): The equipment item to associate to this slot, or nil
to make the slot empty.Returns the current built-in effect of a game command.
This function is useful if you want to show a HUD that indicates to the player the current effect of pressing a game command, especially for command "action"
whose effect changes a lot depending on the context.
command
(string): Name of a game command. Valid commands are "action"
, "attack"
, "pause"
, "item_1"
, "item_2"
, "right"
, "up"
, "left"
and "down"
.nil
means that this command has currently no built-in effect (for example because the game is paused). Possible values are:"action"
: "next"
, "look"
, "open"
, "lift"
, "throw"
, "grab"
, "speak"
, "swim"
, "run"
or nil
."attack"
: "sword"
or nil
."pause"
: "pause"
, "return"
or nil
."item_1"
: "use_item_1"
or nil
."item_2"
: "use_item_2"
or nil
."right"
: "move_right"
or nil
."left"
: "move_left"
or nil
."up"
: "move_up"
or nil
."down"
: "move_down"
or nil
.Returns the keyboard key that triggers the specified game command.
command
(string): Name of a game command. Valid commands are "action"
, "attack"
, "pause"
, "item_1"
, "item_2"
, "right"
, "up"
, "left"
and "down"
.nil
if no keyboard key is mapped to this game command.Sets the keyboard key that triggers a game command.
command
(string): Name of a game command. Valid commands are "action"
, "attack"
, "pause"
, "item_1"
, "item_2"
, "right"
, "up"
, "left"
and "down"
.nil
means none).Returns the joypad input that triggers the specified game command.
command
(string): Name of a game command. Valid commands are "action"
, "attack"
, "pause"
, "item_1"
, "item_2"
, "right"
, "up"
, "left"
and "down"
.nil
if no joypad input is mapped to this game command. This string can have one of the following forms:"button X"
where X is the index of a joypad button (first is 0
),"axis X +"
where X is the index of a joypad axis (first is 0
),"axis X -"
where X is the index of a joypad axis (first is 0
),"hat X Y"
where X is the index of a joypad hat (first is 0
) and Y is a direction (0
to 7
).Sets the joypad input that should trigger the specified game command.
command
(string): Name of a game command. Valid commands are "action"
, "attack"
, "pause"
, "item_1"
, "item_2"
, "right"
, "up"
, "left"
and "down"
.nil
means none). This string must have one of the following forms:"button X"
where X is the index of a joypad button (first is 0
),"axis X +"
where X is the index of a joypad axis (first is 0
),"axis X -"
where X is the index of a joypad axis (first is 0
),"hat X Y"
where X is the index of a joypad hat (first is 0
) and Y is a direction (0
to 7
).Makes the next keyboard or joypad input become the new binding for the specified game command.
This function returns immediately. After you call it, the next time the player presses a keyboard key or performs a joypad input, this input is treated differently: instead of being forwarded to your script or handled by the engine as usual, it automatically becomes the new keyboard or joypad binding for a game command.
command
(string): Name of a game command. Valid commands are "action"
, "attack"
, "pause"
, "item_1"
, "item_2"
, "right"
, "up"
, "left"
and "down"
.callback
(function, optional): A function to call when the new input occurs.Returns whether a built-in game command is currently pressed.
command
(string): Name of a game command. Valid commands are "action"
, "attack"
, "pause"
, "item_1"
, "item_2"
, "right"
, "up"
, "left"
and "down"
.true
if this game command is currently pressed by the player.Returns the direction (in an 8-direction system) formed by the combination of directional game commands currently pressed by the player.
0
to 7), or nil
for no direction. No direction means that no directional command is pressed, or that contradictory directional commands are pressed, like left and right at the same time (impossible with most joypads, but easy with a keyboard).Creates a command pressed input event.
Everything acts like if the player had just pressed an input mapped to this game command.
command
(string): Name of a game command. Valid commands are "action"
, "attack"
, "pause"
, "item_1"
, "item_2"
, "right"
, "up"
, "left"
and "down"
.Creates a command released input event.
Everything acts like if the player had just released an input mapped to this game command.
command
(string): Name of a game command. Valid commands are "action"
, "attack"
, "pause"
, "item_1"
, "item_2"
, "right"
, "up"
, "left"
and "down"
.Events are callback methods automatically called by the engine if you define them. In the case of a game, they are only called on the game currently running, if any.
Called when this game starts running (including when you restart the same game).
Called when this game stops running (including when you restart the same game).
Called at each cycle of the main loop while this game is running.
Called when the game has just been redrawn by the engine.
The engine has already drawn the current map, since the map is always drawn before the game. If the game has menus, these menu are not drawn yet at this point. Use this event if you want to draw some additional content before the menus.
dst_surface
(surface): The surface where the game is drawn.Called when the player has just entered a map.
The new map is already started at this point. For example, you may use this event if some parts of your HUD needs to be changed on particular maps.
map
(map): The new active map.Called when the player has just entered a map whose world is different from the previous one.
Recall that maps without a world property are considered to be in their own world, different to all other maps. Therefore, if at least one of the previous and the new map has no world property, this event is necessarily called.
This event is called right after game:on_map_changed().
previous_world
(string): The world of the previous map if any, or nil
if the previous map had no world set or if there was no previous map.new_world
(string): The world of the new map if any, or nil
if the mew map had no world set.Called when the game has just been paused.
The game may have been paused by the player (by pressing the "pause"
game command) or by you (by calling game:set_paused(true)).
This function is typically the place where you should start your pause menu.
Called when the game is being resumed.
The game may have been unpaused by the player (by pressing the "pause"
game command) or by you (by calling game:set_paused(false)).
This is probably a good place to stop your pause menu.
Called when a dialog starts.
The dialog may be triggered by a Lua script (by calling game:start_dialog()) or by the engine in various situations (for example when finding a treasure).
If this event is not defined, the engine shows a minimal dialog box without decoration and you have nothing else to do.
If this event is defined, the engine does nothing and your script is responsible to show the dialog in any way you want, and to close it later by calling game:stop_dialog(). It is recommended to implement your dialog system as a menu: if you do so, you will automatically get called by the engine when a command is pressed, when you need to draw the dialog box on the screen, etc.
dialog
(table): All properties of the dialog to show. This table is identical to the one returned by sol.language.get_dialog(). It is a table with at least the following two entries:
dialog_id
(string): Id of the dialog.text
(string): Text of the dialog in the current language. It may have several lines. When it is not empty, it always ends with a newline character.The table also contains all custom entries defined in text/dialogs.dat for this dialog. These custom entries always have string keys and string values. Values that were defined as numbers in "text/dialogs.dat"
are replaced in this table by their string representation, and values that were defined as booleans are replaced by the string "1"
for true
and "0"
for false
.
info
(any value, optional): Some additional information for this particular dialog. You can get here some data that is only known at runtime. See the examples of game:start_dialog().Called when the current dialog stops.
dialog
(table): All properties of the dialog that was shown. See game:on_dialog_started() for a description of this table.Called when a game-over sequence starts.
This event is called when the player's life reaches zero, as soon as the hero is in a state that allows game-over. It is also called if you started a game-over sequence manually with game:start_game_over().
If this event is not defined, there is no game-over sequence: the game restarts immediately, like if you called game:start(), and the full life of the player is restored.
If this event is defined, the engine does nothing except suspending the game. Your script is then responsible to show a game-over sequence in any way you want, and to call game:stop_game_over() once you have finished.
For instance, you may create a dialog that lets the player restart the game or save and quit, or a menu with more options.
Actually, it is not even required to restart or quit the game after your game-over sequence (even if this is the most common case). Indeed, you can also just resume the game. In this case, the game continues normally like if nothing happened.
Called when the current game-over sequence stops.
This event is also called if you did not define a game-over sequence.
Called when the user presses a keyboard key while your game is running.
key
(string): Name of the raw key that was pressed.modifiers
(table): A table whose keys indicate what modifiers were down during the event. Possible table keys are "shift"
, "control"
and "alt"
. Table values are true
.true
, the event won't be propagated to other objects. If you return false
or nothing, the event will continue its propagation in this order: to the game menus if any, to the current map (including its own menus if any), and then to the game commands.If you handle the event, you should return true
to make the event stop being propagated. The menus of your game (if any) and the current map won't be not notified in this case. On the contrary, if neither your game, its menus nor the current map handle the event, then the engine handles it with a built-in behavior. This built-in behavior is to check whether a game command is mapped to the keyboard key that was pressed. If yes, the keyboard pressed event will be transformed into a game command pressed event (see game:on_command_pressed()).
Called when the user releases a keyboard key while your game is running.
key
(string): Name of the raw key that was released.true
, the event won't be propagated to other objects. If you return false
or nothing, the event will continue its propagation in this order: to the game menus if any, to the current map (including its own menus if any), and then to the game commands.If you handle the event, you should return true
to make the event stop being propagated. The menus of your game (if any) and the current map won't be not notified in this case. On the contrary, if neither your game, its menus nor the current map handle the event, then the engine handles it with a built-in behavior. This built-in behavior is to check whether a game command is mapped to the keyboard key that was released. If yes, the "keyboard released" event will be transformed into a "game command released" event (see game:on_command_released()).
Called when the user enters text while your game is running.
character
(string): A utf-8 string representing the character that was entered.true
, the event won't be propagated to other objects. If you return false
or nothing, the event will continue its propagation in this order: to the game menus if any and then to the current map (including its own menus if any).Called when the user presses a joypad button while your game is running.
button
(number): Index of the button that was pressed.true
, the event won't be propagated to other objects.Called when the user releases a joypad button while your game is running.
button
(number): Index of the button that was released.true
, the event won't be propagated to other objects.Called when the user moves a joypad axis while your game is running.
axis
(number): Index of the axis that was moved. Usually, 0
is an horizontal axis and 1
is a vertical axis.state
(number): The new state of the axis that was moved. -1
means left or up, 0
means centered and 1
means right or down.true
, the event won't be propagated to other objects.Called when the user moves a joypad hat while your game is running.
hat
(number): Index of the hat that was moved.direction8
(number): The new direction of the hat. -1
means that the hat is centered. 0
to 7
indicates that the hat is in one of the eight main directions.true
, the event won't be propagated to other objects.Called when the player presses a game command (a keyboard key or a joypad action mapped to a built-in game behavior) while this game is running. You can use this event to override the normal built-in behavior of the game command.
command
(string): Name of the built-in game command that was pressed. Possible commands are "action"
, "attack"
, "pause"
, "item_1"
, "item_2"
, "right"
, "up"
, "left"
and "down"
.true
, the event won't be propagated to other objects (you are overriding the built-in behavior of pressing this game command).Called when the player released a game command (a keyboard key or a joypad action mapped to a built-in game behavior). while this game is running. You can use this event to override the normal built-in behavior of the game command.
command
(string): Name of the built-in game command that was released. Possible commands aretrue
, the event won't be propagated to other objects (you are overriding the built-in behavior of releasing this game command).Called when the user presses a mouse button while the game is running.
button
(string): Name of the mouse button that was pressed. Possible values are "left"
, "middle"
, "right"
, "x1"
and "x2"
.x
(integer): The x position of the mouse in quest size coordinates.y
(integer): The y position of the mouse in quest size coordinates.true
, the event won't be propagated to other objects.Called when the user releases a mouse button while the game is running.
button
(string): Name of the mouse button that was released. Possible values are "left"
, "middle"
, "right"
, "x1"
and "x2"
.x
(integer): The x position of the mouse in quest size coordinates.y
(integer): The y position of the mouse in quest size coordinates.true
, the event won't be propagated to other objects.Called when the user presses a finger while the game is running.
finger
(integer): ID of the finger that was pressed.x
(integer): The x position of the finger in quest size coordinates.y
(integer): The y position of the finger in quest size coordinates.pressure
(number): The pressure of the finger, normalized between 0 and 1.true
, the event won't be propagated to other objects.Called when the user releases a finger while the game is running.
finger
(integer): ID of the finger that was pressed.x
(integer): The x position of the finger in quest size coordinates.y
(integer): The y position of the finger in quest size coordinates.pressure
(number): The pressure of the finger, normalized between 0 and 1.true
, the event won't be propagated to other objects.Called when the user moves a finger while the game is running.
finger
(integer): ID of the finger that was pressed.x
(integer): The x position of the finger in quest size coordinates.y
(integer): The y position of the finger in quest size coordinates.dx
(integer): The horizontal distance moved by finger in quest size coordinates.dy
(integer): The vertical distance moved by finger in quest size coordinates.pressure
(number): The pressure of the finger, normalized between 0 and 1.true
, the event won't be propagated to other objects.