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

Cooldown Behavior #198

Open
jgrenda opened this issue Dec 2, 2023 · 0 comments
Open

Cooldown Behavior #198

jgrenda opened this issue Dec 2, 2023 · 0 comments

Comments

@jgrenda
Copy link
Collaborator

jgrenda commented Dec 2, 2023

During the creation of prototypes, it might be necessary to allow a certain action to be performed only every X seconds. In the same vein, it might be required to prevent performing a certain action for X seconds after its execution.
Examples might be the shooting of a gun which happens on mouse-click but should not happen more often than once every 0.5 seconds, or a power-up that lasts 10 seconds with a certain effect.

The cooldown effect currently can be realized using multiple connections:

  • if not value in Store to symbolize cooldown, trigger action
  • start Clock Behavior with a duration of wanted cooldown value and on-elapsed remove cooldown value from Store
  • write cooldown value to Store

image

This is cumbersome and requires a specific order of operation to prevent deadlocks or ineffective cooldowns.
As such constructs are required more often than previously anticipated a dedicated behavior for this might be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant