Closed Deslucir closed 9 months ago
@Deslucir, thanks a lot for taking the time to send a PR! I am not sure if I understand the feature correctly though. If the goal is to have transitions that are checked per frame, you can already have this. Let your transition listen to a "tick" event and then just send a "tick" event every frame to your state chart, e.g.
func _process(delta):
state_chart.send_event("tick")
Could you also give me some more information about the use case behind this feature? In general I feel polling for a condition is something one wants to avoid if possible, so I wonder if this could actually be better done with some signal rather than checking for a condition every frame.
I'm closing this as it has been dormant for a while.
Hey everybody!
I tried to implement something with godot-statecharts and it did not work how I imagined it. So I debugged everything and read through the documentation a little bit.
In the code I found that transitions are only evaluated on entering the state or a relevant event was send. I also found in the documentation statecharts.dev/guard the following paragraph:
I interpret it that a guard should be able to be checked an any time. So I implemented it as an optional feature that the user can choose if the transition will be checked every frame. I found a small problem with my implementation and fixed it here https://github.com/derkork/godot-statecharts/commit/a603e7d4e1b2cdc7b74ae5d7ade6bc56b1ba0ffe but that does not feel good in the current state how I implemented it. The result worked how I imagined it, so I created a small demo to show the new functionality in action.
I hope this fits into the vision of this project! Feel free to edit it as you please or suggest stuff that I should change, rename or delete!