Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide signals for _input and _unhandled_input #4

Closed
ibokuri opened this issue Apr 13, 2023 · 1 comment
Closed

Provide signals for _input and _unhandled_input #4

ibokuri opened this issue Apr 13, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@ibokuri
Copy link

ibokuri commented Apr 13, 2023

If possible, I think that states should provide signals for _input and _unhandled_input, similar to how there are signals for _process and _physics_process. This change would allow for slightly more optimal code since the input functions only fire whenever there's a change in input, whereas the process functions fires every frame.

Currently, my workaround for this is to, in my player's _unhandled_input function, emit a state event (e.g., "interact") and then have a signal handler, which is connected to the event_received for all relevant states, handle the event appropriately. This works fine, but is a bit hacky and you do lose all information about the input event itself.

P.S. I've only just started using godot-statecharts and it has already been so useful for me! Thanks a lot for the awesome plugin!

@derkork
Copy link
Owner

derkork commented Apr 17, 2023

Hi @ibokuri this sounds like a useful addition. I'll add this in an upcoming version.

@derkork derkork added the enhancement New feature or request label Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants