-
Notifications
You must be signed in to change notification settings - Fork 207
FIX #193 - Angle based movement for actors #339
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
Open
Mambouna
wants to merge
8
commits into
lordmauve:main
Choose a base branch
from
Mambouna:actor_angle_movement
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Author
|
@lordmauve Any thoughts on this? |
Adds the following functions to move actors: - move_towards_angle(angle, distance) : Moves the actor towards the given angle by the given amount. - move_towards_point(point, distance) : Convenience function that just runs angle_to(point), followed by move_towards_angle(angle, distance). - move_forward(distance) : Moves the actor along its angle by the given distance. - move_backward(distance) : Moves the actor in the opposite direction of its angle by the given distance. - move_left(distance) : Moves the actor left based on its angle by the given distance. - move_right(distance) : Moves the actor right based on its angle by the given distance.
Former approach was broken due to not rememberin math and python right while not having internet... Now, the movement functions behave properly. One major bug is left before this can be pulled. When running move_towards_point() every update, it results in a jittering back and forth which is not expected until the actor overshoots the target point. Instead it happens every single frame.
The previously mentioned bug was not part of the new functionality but caused by a typo in the testing project. From current observation, move_towards_point() works correctly. Unless relevant reworks are necessary, the functionality for this PR is now done.
Added an optional parameter to `move_towards_point()` named `overshoot` that is `False` by default. Actors will now automatically come to stop at the target when moving towards a point (preventing the rapid back and forth from before) unless `overshoot` is supplied as `True`. Updated documentation to reflect this change.
551877a to
405728e
Compare
Author
|
As with the mouse PR, I added unit tests for all new functionality, which I hope are good. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds the following functions to actor.py allowing for easier movement when actors are rotating:
move_towards_angle(angle, distance): Base function of this PR. All other functions use this.move_towards_point(point, distance, overshoot=False): Simply calls angle_to(point) and then usesmove_towards_angle(). By default, the actor stops at the target point if the given distance was greater. This can be changed by giving a third parameterovershootasTrue, which disables the convenience check.move_forward(distance): Moves in the direction the actor is facing.move_backward(distance): Moves in the opposite direction of the one the actor is facing.move_left(distance): Moves left in relation to the facing of the actor. I am conflicted an the name right now. Another option could bestrafe_left()but then there is no consistency with the other functions.move_right(distance): Analog tomove_left().Fixes #193.