Skip to content

Feature request: New method in the Sprite class to rotate it to face a given Point #1091

@sallywag

Description

@sallywag

Enhancement request:

A new method in the Sprite class to rotate it to face a given Point (or another Sprite). Perhaps give the option for it to instantly face a given Point or gradually turn towards it. Perhaps allow a Sprite as the parameter as well as a Point, so you can do something like player.look_at(enemy).

What should be added/changed?

A new method in the Sprite class. For example:

def look_at(self, point: Point) -> None: self.angle = math.degrees( math.atan2(point.x - self.center_y, point.y - self.center_x) )

What would it help with?

Simplify rotating one sprite to face another. This seems like something that is commonly done in 2D games that should not require manual calculations.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions