Bug? Actor width and height are writeable
- Dominant language
- Python
- Stars
- 611
- Forks
- 211
- PR merge metrics
- No merged PRs in 30d
Description
Currently, there is no support for changing the dimensions of an actor via the `height` and `width` attributes (although multiple proposals and some PRs exist for this).
In spite of this, both attributes can freely be changed, without this impacting the drawn picture or any other functionality as far as I can tell.
Until actual functionality is put in place to make changing actors dimensions possible, I think this should be treated as a bug. One of my students has already stumbled over this and thought he was making some mistake when changing the values did nothing.
I propose making width and height read only attributes (via properties) until a full solution is implemented for scaling.
Minimal reproduction example with a visual aid for the variable values:
```python
WIDTH, HEIGHT = 500, 500
a = Actor("alien", (250, 250))
r = Rect((1, 1), (1, 1))
def update():
if keyboard.q:
a.width -= 10
print(a.width)
elif keyboard.e:
a.width += 10
print(a.width)
if keyboard.r:
a.height += 10
print(a.height)
elif keyboard.f:
a.height -= 10
print(a.height)
r.x = a.topleft[0]
r.y = a.topleft[1]
r.width = a.width
r.height = a.height
def draw():
screen.clear()
a.draw()
screen.draw.rect(r, "red")
```
I'll make a PR shortly.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the Actor implementation and locate how its width and height attributes are exposed. Check any existing Actor dimension coverage, then verify that assignments no longer change these attributes while the current drawing behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100