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

Input and movement #355

Merged
merged 2 commits into from
Nov 26, 2020
Merged

Input and movement #355

merged 2 commits into from
Nov 26, 2020

Conversation

steffen-wilke
Copy link
Contributor

@steffen-wilke steffen-wilke commented Nov 26, 2020

Use proper trigonometry to calculate velocity and angle for entity movement.

  • Decelerate to 0 in one tick if the deceleration is set to 0ms instead of decelerating by the tick velocity.
  • Extend the EntityMovedEvent by the distance property.
  • Revamp the public API of the MovementController.

Fixes #354

Merge the InputLoop with the GameLoop

Having separate loops in the engine always caused synchronization issues between the threads especially when dispatching input events into game logic performed on the "normal" game loop (e.g. MovementControllers).

With this change, the input devices, as well as the sound engine, are being updated by the usual GameLoop.
Custom implementations that previously relied on the input loop as a means to run independently from the "normal" game loop can now be implemented using an own UpdateLoop instance.

…vement.

- Decelerate to 0 in one tick if the deceleration is set to 0ms instead of decelerating by the tick velocity.
- Extend the EntityMovedEvent by the distance property.
- Revamp the public API of the MovementController.
Having separate loops in the engine always caused synchronization issues between the threads especially when dispatching input events into game logic performed on the "normal" game loop (e.g. MovementControllers).
With this change, the input devices as well as the sound engine are being updated by the usual GameLoop.
Custom implementations that previously relied on the input loop as a mean to run independently from the "normal" game loop can now be implemented using an own UpdateLoop instance.
@steffen-wilke steffen-wilke added this to the v0.5.1-beta milestone Nov 26, 2020
@steffen-wilke steffen-wilke merged commit 9df1176 into master Nov 26, 2020
@nightm4re94 nightm4re94 deleted the input_and_movement branch February 1, 2021 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Correct speed when moving diagonally
1 participant