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 move_towards fct in Actor #277

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

yansnow78
Copy link

@yansnow78 yansnow78 commented Jan 31, 2022

add move_towards fct in Actor
the change in code is inspired from pgzhelper
def move_towards(self, direction:Union[int, float, Actor, _Coordinate], distance, stop_on_target=True):
what it does:
"""move actor position of a certain distance in pixels in a certain direction
this direction can be an angle in degrees or an Actor or a point coordinate"""

orignally in pgzhelper, there was much more function but move_towards can do all
maybe the function point_towards will be cool to have to
this is what was orignally in pgzhelper

  direction:float
  def move_towards(self, actor, dist): # move in direction to another actor
  def point_towards(self, actor): # point in direction to another actor
  def move_in_direction(self, dist): # move in direction to self.direction
  def move_forward(self, dist): # move in direction to self.anlge
  def move_left(self, dist): # move in direction to self.angle+90
  def move_right(self, dist): # move in direction to self.angle-90
  def move_back(self, dist): # move in direction opposite to -self.angle

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.

None yet

1 participant