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

Add stop/reset functionality to RepeatForever action #3280

Open
dmytropaduchak opened this issue Nov 17, 2024 · 2 comments
Open

Add stop/reset functionality to RepeatForever action #3280

dmytropaduchak opened this issue Nov 17, 2024 · 2 comments
Labels
feature Label applied to new feature requests stale This issue or PR has not had any activity recently

Comments

@dmytropaduchak
Copy link

Context

The RepeatForever action in Excalibur.js currently loops indefinitely, providing no built-in mechanism for resetting the action once it is in progress. In scenarios where more control over the flow of repeated actions is required (e.g., restarting the animation after a specific event or condition), developers are left without an efficient way to manage these actions.

  • The current implementation of RepeatForever does not allow for resetting the action, which can be limiting for game developers who need more flexibility in controlling repeated actions.
  • Developers may need to manually recreate or manage actions outside the RepeatForever context, leading to extra complexity and potential bugs.

Proposal

stop method

  • This method will stop all actions in the repeat cycle, preventing further execution of the repeated actions while maintaining the current state of the actor.
  • Once stopped, the action should remain halted until explicitly resumed or reset.
public stop(): void {
  this._stopped = true;
  this._actionQueue.getActions().forEach((i) => i.stop());
}

reset method

  • This method will reset the RepeatForever action, allowing it to restart from its initial state. The actor will return to its default position, and the repeated actions will be reinitialized.
  • After calling reset(), the repeated actions should begin again from the start, as if it was newly created.
public reset(): void {
  this._stopped = false;  
  this._actionQueue.reset();
}
@eonarheim
Copy link
Member

@dmytropaduchak I think this is a great idea! I fully support this feature

@eonarheim eonarheim added the feature Label applied to new feature requests label Nov 17, 2024
Copy link

This issue hasn't had any recent activity lately and is being marked as stale automatically.

@github-actions github-actions bot added the stale This issue or PR has not had any activity recently label Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Label applied to new feature requests stale This issue or PR has not had any activity recently
Projects
None yet
Development

No branches or pull requests

2 participants