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

Relatively Positioned Sprites #667

Open
pathunstrom opened this issue Feb 5, 2022 · 0 comments
Open

Relatively Positioned Sprites #667

pathunstrom opened this issue Feb 5, 2022 · 0 comments

Comments

@pathunstrom
Copy link
Collaborator

Requires #666

Specifically intended as subsprites (#577), a RelativeSprite uses a separate attribute for its position. We'll call it relative_position. RelativeSprite.position becomes a property that returns the relative position in relation to the position and rotation of its parent.

For now, we'll leave RelativeSprite's own rotation alone, but if testing proves it necessary, rotation will need a similar split.

The basic idea:

return self.relative_position.rotate(self._parent.rotation) + self.parent.position

The goal is so that things like skeleton sprites (sprites who are made up of multiple sprites for animations), subordinate sprites (think r-types support ships), and particle systems don't need to worry about where they are in relation to the rest of their objects and can just move themselves, then get places appropriately by the renderer.

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

No branches or pull requests

1 participant