Skip to content

Tile Events

Joao Paulo Oliveira Fernandes edited this page Jan 21, 2024 · 28 revisions

Description

Tile events are created as map properties in a Tiled map. This is the class of events that are placed on the map. Generally, this kind of event is fired when the hero reaches the position where an event of this type is placed. Use these events to make the hero jump, slide, climb, teleport, etc. Tile Events are set as map properties (and sometimes, Interactable Objects can also create some Tile Events automatically). The map property key should be in the following format: tile_event/<unique_key_name>. The map property value is a JSON object as described below in this doc.

Example of a "jump" event:

{
  "type": "jump",
  "x": 16,
  "y": 7,
  "activation_directions": "left",
  "activation_collision_layers": 2
}

Common properties

These are the properties that are common among all Tile Event types.

Properties

  • type [string]: the Tile Event type. Required property.
  • x [number]: the x tile position of the event. Required property.
  • y [number]: the y tile position of the event. Required property.
  • activation_collision_layers [number|array]: the activation collision layer or a list of these. Optional property. Default value is 0.
  • key_name [string]: optionally, you can set a unique key name for this event. This is useful when you want to identify this particular event when dealing with Game Events, for example. Optional property.
  • initial_disabled_directions [string|array]: list of directions that will be disabled initially. Values must be the following: "right", "up_right", "up", "up_left", "left", "down_left", "down", "down_right" or "all". Even though diagonal directions are allowed, some events don't support them, like jump events (see details on specific event type description). Optional property.
  • activation_directions [string|array]: list of directions that will be active initially. Values must be the following: "right", "up_right", "up", "up_left", "left", "down_left", "down", "down_right" or "all". Even though diagonal directions are allowed, some events don't support them, like jump events (see details on specific event type description). The final list of activation directions will be this property value minus the list set in initial_disabled_directions property. Optional property. Default value is "all".
  • active_storage_key [string]: this event activation can be controlled by a boolean storage value. This property receives the storage key name to control activation. If this storage value is false, the entire event is deactivated, otherwise, it will be active based on activation_directions and initial_disabled_directions properties values. Optional property.
  • affected_by_reveal [boolean|array]: if true, this event activation (on directions given by activation_directions and initial_disabled_directions properties) will be toggled on Reveal psynergy cast. Beyond a boolean, this property also accepts an array of specific directions that you want to be sensible to Reveal, in this case, values must be the following: "right", "up_right", "up", "up_left", "left", "down_left", "down", or "down_right". Optional property. Default value is false.

Event types

"climb" event:

Use this event to toggle the hero state between climbing and not climbing. Animations are done by default. This event can automatically identify the hero's current state: if the hero is climbing, then on this event activation the hero will stop climbing. Classical usage is when the hero needs to use a ladder. This event only supports "up" or "down" activation directions.

Properties

  • change_to_collision_layer [number]: the destination collision layer after this event takes effect. Optional property. Default value is current collision layer.

"collision" event:

Use this event to change the collision layer of the map. This event is fired when the hero leaves this event position based on the activation direction. The activation direction can be one or a list of the following: "right", "left", "up", "down", "up_left", "down_left", "up_right", "down_right".

Properties

  • dest_collision_layer [number]: the destination collision layer after this event takes effect. Required property.

"event_trigger" event:

Use this event to trigger a list of Game Events. These events will be fired when the hero touches this event.

Properties

  • events [array]: a list of Game Events that will be fired when the hero touches this event. Optional property.
  • remove_from_field [boolean]: if true, this event will be removed from map after activation. Optional property. Default is false.
  • trigger_once [boolean]: if true, once you reached the position of this event, it will be triggered again only if you exit and return to this event position, in other words, it won't keep firing while you're over it, you need to exit and return. Optional property. Default is false.
  • trigger_on_exit [boolean]: if true, this event will be fired on this event position exit instead of this event position enter. Optional property. Default is false.

"fall" event:

Make the hero to fall to a specific location in this map or to another map. This event will be fired when the hero touches this event.

Properties

  • y_destination_position [number]: the y destination the the hero will reach when falling. This value must be bigger than hero current location. Required property.
  • dest_collision_layer [number]: the collision layer index that the hero will be after falling. Optional property.
  • show_exclamation_emoticon [boolean]: if true, will show a exclamation emoticon over the hero before he falls. Optional property. Default is false.
  • splash_sweat_drops [boolean]: if true, the hero will splash sweat drops before het falls. Optional property. Default is false.
  • walking_in_the_air [boolean]: if true, the hero will "walk in the air" before he falls. Optional property. Default is false.
  • ground_hit_animation [boolean]: if true, the hero will emit some dust when hitting the ground on fall finish. Optional property. Default is false.
  • teleport [object]: property that will contain teleport info in the case the hero will fall to another map. If you don't want to teleport, simply don't set this property. Optional property.
    • destination [string]: the destination map key name. Required property.
    • origin_position [object]: The origin position that the char will be just after the teleport and before reaching destination_position. If not passed, the engine will try to guess this origin position. Optional property.
      • x [number]: the x tile position. Required property.
      • y [number]: the y tile position. Required property.
    • destination_position [object]: the final destination tile position that the hero will reach when hitting the ground after falling. Required property.
      • x [number]: the x tile position. Required property.
      • y [number]: the y tile position. Required property.
    • dest_collision_layer [number]: the final collision layer index that the hero will be on the target map after teleporting and after falling. Required property.
    • send_to_front_on_teleport [boolean]: if true, the hero sprite will on the front of other sprites only while falling in the target map. Optional property. Default is false.
    • diminish_on_transition [boolean]: if true, the hero sprite will have your scale set to zero instead of reaching the position specified in the "y_destination_position" property. This only happens in the current map. Optional property. Default value is false.

"ice_slide" event:

Use this event to toggle the hero state between sliding on the ice and not sliding on the ice. Animations are done by default. This event can automatically identify the hero's current state: if the hero is sliding, then on this event activation the hero will stop sliding. This event only supports "up", "down", "left", or "right" activation directions.

Properties

  • start_sliding_direction [string]: the direction that the sliding will start. It must be one of the following: "up", "down", "left", or "right". Required property.

"jump" event:

This event will allow the hero to jump one tile distance. In order for this event to work, the target destination has to have another jump event with activation in the opposite direction of this one. Animations are done by default. This event only supports "up", "down", "left", and/or "right" activation directions.

Properties

  • ignore_destination_rule [boolean]: when set to true, this event will ignore the rule that obliges having a jump event in the destination of this event in the opposite direction. Optional property. Default value is false.

"rope" event:

This is an internal event, you don't need to create this one. This kind of event is created automatically when placing a Rope Dock Interactable Object. Use this event to toggle the hero state between climbing/walking over a rope and not climbing/walking over a rope. Animations are done by default. This event only supports "up", "down", "left", and/or "right" activation directions.

Rope events:

Properties

  • walk_over_rope [boolean]: if true, the hero will walk over the rope instead of climbing. Optional property. Default value is true.
  • dock_exit_collision_layer [number]: the collision layer that the hero will be on dock exit. Optional property. Default value is 0.
  • rope_collision_layer [number]: the collision layer the hero will be in when jumping over the dock. Optional property.

"slider" event:

This event will allow the hero to slide down to a different collision layer. Optionally, you can use this event to teleport to another location while the hero is falling just after the slide. Animations are done by default. This event only supports "down" activation direction.

Properties

  • x_target [number]: the x tile destination position. Required property.
  • y_target [number]: the y tile destination position. Required property.
  • dest_collision_layer [number]: the destination collision layer. Optional property. Default value is 0.
  • show_dust [boolean]: if true, will show some dust while sliding. Optional property. Default value is true.
  • teleport [boolean]: set this property to true if you want to teleport to another location while falling. Optional property. Default value is false.
  • teleport_target [string]: the map key name that you want the hero to teleport. Optional property. This property is only valid if teleport property is set to true.
  • teleport_init_x [number]: the initial x tile position when falling in the target map. Optional property. This property is only valid if teleport property is set to true.
  • teleport_init_y [number]: the initial y tile position when falling in the target map. Optional property. This property is only valid if teleport property is set to true.
  • teleport_end_x [number]: the final x tile position when hitting the ground in the target map. Optional property. This property is only valid if teleport property is set to true.
  • teleport_end_y [number]: the final y tile position when hitting the ground in the target map. Optional property. This property is only valid if teleport property is set to true.
  • ground_hit_animation [boolean]: if true, the engine will play a ground hit animation for the hero. Optional property. Default value is true. This property is only valid if teleport property is set to true.

"speed" event:

This event allows manipulating the speed of the hero. You can use it to increase a delta value in any direction or to set it as a vector which means that the hero speed will be the resulting vector between the given vector in this event and the hero current speed vector (useful when walking upstream, for example). This event supports all activation directions.

Properties

  • speed [number]: the speed delta value to be incremented. Can be a positive or negative value. Required property.
  • on_stairs [boolean]: if true, the hero will keep its direction even if it's colliding with something. Usually, we set it to true if the hero is stepping a diagonal stair. Optional property. Default value is false.
  • force_axis [string]: setting this property will change the behavior of how the engine will apply the speed set. Set the axis in which the speed will be applied. When setting the axis, the hero will always be affected by the set speed, even if idle. When this axis is set, the signal of the speed won't represent more or less speed, but the direction of the speed. The value of this property must be one of the following: "x" or "y". Optional property.

"step" event:

When the hero leaves the position of this event in the activation direction, it will step up or down. This event only supports "up", "down", "left", or "right" activation directions.

Properties

  • step_direction [string]: the direction of the step, whether the hero will step down or up. The value of this property must be one of the following: "up" or "down". Required property.

"teleport" event:

Teleports the hero to another location. A fade transition is done while the hero is teleporting. This event only supports "up", "down", "left", and/or "right" activation directions.

Properties

  • target [string]: the map key name that the hero will be teleported. Required property.
  • x_target [number]: the destination x tile position. Required property.
  • y_target [number]: the destination y tile position. Required property.
  • open_door [boolean]: starts an open dor animation before teleporting. Optional property. Default value is false.
  • door_settings [object]: a set of configurations to tell how to properly replace closed-door tiles with open-door tiles. Only valid if open_door property was set to true. Optional property.
    • door_open_sfx [string]: the sfx to be played when the door is open. Optional property. Default value is "door/open_door".
    • replace_map [array]: list of settings telling how to replace each tile of the door. The size of this list is the same as the size of tiles the teleport door has. Required property. All the tile positions and offsets passed on this property have to be in terms of Tiled map tile size.. For tile ids in below properties, you can get them from Tiled by clicking on a tile in the Tileset widget then the id will appear in the clicked tile properties.
      • tile_layer [string]: the tile layer name where this door tile is. Required property.
      • from_tile_id [number]: the current/closed door tile id. Required property.
      • to_tile_id [number]: the open door tile id. Required property.
      • offset_x [number]: the x tile offset number of this door tile from event x position. Required property.
      • offset_y [number]: the y tile offset number of this door tile from event y position. Required property.
      • origin_x [number]: the x origin Tiled tile position where above offset properties will be applied. This property is useful when your Tiled map tile size is different than in-game tile size. Optional property. If not passed, the engine will try to infer the Tiled tile position from event in-game position.
      • origin_y [number]: the y origin Tiled tile position where above offset properties will be applied. This property is useful when your Tiled map tile size is different than in-game tile size. Optional property. If not passed, the engine will try to infer the Tiled tile position from event in-game position.
  • start_climbing [boolean]: fires a climbing-start animation before teleporting and starts in the climbing mode in the target map. Optional property. Default value is false.
  • stop_climbing [boolean]: stops climbing after teleporting. Starts in the non-climbing mode (idle mode) in the target map. Optional property. Default value is false.
  • keep_encounter_cumulator [boolean]: if true, it will keep the encounter accumulator value when teleporting. It only keeps when teleporting between maps with same key name. Optional property. Default value is true.
  • dest_collision_layer [number]: the destination collision layer. Optional property. Default value is 0.
  • destination_direction [string]: the destination hero direction. Can be one of the following: "right", "left", "up" or "down". Optional property. Default value is this event activation direction.
  • spiral_stair [string]: if this property is set, the hero will play an animation of going in or out of a spiral stair, depending on what's set in this property. Must be one of the following values: "up" (if going upstairs) or "down" (if going downstairs). Optional property.
  • on_event_toggle_layers [string|array]: This property accepts a tile layer name or a list of tile layer names. These tile layers will have their visibility toggled on this teleport event fire. Optional property.
  • fade_color [string]: the fade-in color when teleporting. Set the number as a string but in hexa, example: "0xfff". Optional property. Default is "0x0" (black).
  • custom_sfx [string]: sets a custom sfx key to be played on teleport init. Optional property.
  • particles_info [array]: to be documented. Optional property.
  • custom_advance_time [array]: only valid if open_door or particles_info properties are set. The time in ms that the hero will take to walk up before teleporting. Optional property. Default value is 400.
  • custom_advance_shift [array]: only valid if open_door or particles_info properties are set. The distance in px that the hero will walk before teleporting. Optional property. Default value is 15.
  • fade_on_advance [array]: only valid if open_door or particles_info properties are set. If true, the hero sprite will fade out while walking up before teleporting. Optional property. Default value is false.
  • watery_filter_on_advance [array]: only valid if open_door or particles_info properties are set. If true, the hero sprite will get watery colors while walking up before teleporting. This is useful when entering through a waterfall. Optional property. Default value is false.
Clone this wiki locally