TileButton
┗> Event > Object > Class
Constructor
TileButton(x: any, y: any, shape: any, properties: any, idle_sprite: any, pressed_sprite: any)
Arguments:
x: any | |
y: any | |
shape: any | |
properties: any | |
idle_sprite: any | |
pressed_sprite: any |
Methods
TileButton:checkCompletion()
Checks whether the tile button puzzle is completed and then calls onCompleted()
or onIncompleted()
appropriately.
TileButton:onCompleted()
Called to run everything that happens when the tile button puzzle is completed
TileButton:onIncompleted()
Called to set the tile button puzzle as incomplete
TileButton:onPressed()
Called whenever the button is pressed, setting its sprite and playing the press sound
TileButton:onReleased()
Called whenever the button is released, playing its idle sprite at 6fps (5/30
seconds speed), and playing the release sound
TileButton:setPressed(pressed: boolean)
Changes the pressed state of the button and checks for completion of its puzzle
Arguments:
pressed: boolean |
Returns:
1: boolean |
Fields
TileButton.block_activated: boolean
[Property blocks
] Whether this button is activated by blocks or players and npcs (Defaults to false
- players and npcs)
TileButton.cutscene: string
[Property cutscene
] The name of a cutscene that should play when the button's puzzle is solved
TileButton.flag: string
[Property flag
] The name of a flag to set to true
when the button's group is solved
TileButton.group: string|number
[Property group
] When this value is the same for mutliple tile buttons in one room, they are grouped together, and will not be marked as completed/solved until all of them are pressed simultaneously
TileButton.idle_sprite: string
[Property sprite
] An optional custom sprite to use for this TileButton
TileButton.keep_down: boolean
[Property keepdown
] Whether the button should remain pressed even when the object pressing it moves away (Defaults to false
)
TileButton.npc_activated: boolean
[Property blocks
] Whether this button is activated by blocks or players and npcs (Defaults to true
- players and npcs)
TileButton.off_sound: string
[Property offsound
] The sound file that plays when this button stops being pressed down
TileButton.on_sound: string
[Property onsound
] The sound file that plays when this button is pressed down
TileButton.once: boolean
[Property once
] Whether the tile button's puzzle can only be solved once per save file
TileButton.player_activated: boolean
[Property blocks
] Whether this button is activated by blocks or players and npcs (Defaults to true
- players and npcs)
TileButton.pressed: boolean
Whether the button is currently pressed down
TileButton.pressed_sprite: string
[Property pressedsprite
] An optional custom sprite to use for this TileButton when it is pressed down
TileButton.script: string
[Property script
] The name of a script file that should be executed when the button's puzzle is solved