Event Properties with Callbacks
See original GitHub issueHey again!
In the game I am creating, it will be necessary to be able to know when I am interacting with certain tiles on the map. Since the plugin is the one handling collision checks and movement, I suggest a number of properties that could be super useful for map events. I’ll also give a use case for each event, but these mechanics would be implemented by the game developer. I am only suggesting we add properties for certain tilemap-based events.
-
onEnter
- this event would trigger any time a certain tile has been entered. This could be used in such cases as initiating fights, minigames or puzzle mechanics. -
onStanding
- this event will trigger every frame that the character is standing on the given tile. This could be used for automated platforms for puzzles, weight buttons or healing pads. -
onExit
- this event will trigger when the character leaves a given tile. This could be used to trigger trap doors, or other cinematic effects such as rockslides behind the player. -
onFacing
- this event could be triggered when the player is adjacent to and facing the given tile. This could be used to initiate interactions with objects, dialog with NPCs, et cetera. This would, however, require adding a “facing” mechanic to the plugin itself to implement.
The uses for such events are immense; players could define “trigger” areas on a tilemap that would start certain events or cinematics, and it would facilitate a lot of dynamic interactions with the world such as dialogs, shops, puzzles, platforms, et cetera.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
It looks excellent. I presume we could grab any tile property we wanted via this method, so it’s flexible enough. Excellent work!
@splashsky Published with 1.7.0 release.
There is now an observable
positionChanged()
as well as a method for getting movement state:isMoving()
. I also added methods for getting (getFacingDirection()
) and setting (turnTowards()
) the facing direction.There are three new examples to demonstrate their usage.