Skip to content

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

@lordmauve lordmauve added the actor Issues/PRs involving Actor objects label Apr 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

actor Issues/PRs involving Actor objects

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants