pgzero does not apply rotation to actor when image changed
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 611
- Forks
- 211
- PR merge metrics
- No merged PRs in 30d
Description
When rotating an actor if the image is changed for that actor the new image does not use the rotaton. If the rotation is modified it will carry on from that new images rotation. However if the the actor angle is assigned directly back to itself after the image is change then it still works. So there is currently a work around.
this code will show the problem. When the image changes it will not be in the correct angle.
ship = Actor("ship1")
def on_key_down(key):
if key == keys.RIGHT:
ship.image("ship2")
if key == keys.LEFT:
ship.image("ship1")
def update():
ship.angle -= 1
def draw():
ship.draw()
This code has the work around that basically just sets the angle back to itself after the image is changed.
ship = Actor("ship1")
def on_key_down(key):
if key == keys.RIGHT:
ship.image("ship2")
ship.angle = ship.angle
if key == keys.LEFT:
ship.image("ship1")
ship.angle = ship.angle
def update():
ship.angle -= 1
def draw():
ship.draw()
This bug is not present in the current dev version of pgzero. However that version is completely broken and has not had any attention to those bugs.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the supplied Actor.image, angle, update, and draw example in pgzero, then compare the released behavior with the current dev version. Confirm that changing an image preserves the actor's existing rotation without requiring an explicit self-assignment; done means both image changes render at the correct angle.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100