# Sprite Width And Height Unaffected By Scale Value?

**URL:** <https://forum.code.org/t/sprite-width-and-height-unaffected-by-scale-value/40693>\
**Category:** Coding and Debugging Help\
**Created:** [April 23, 2025, 7:08pm UTC](https://forum.code.org/t/sprite-width-and-height-unaffected-by-scale-value/40693 "2025-04-23T19:08:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jwilson25](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/jwilson25/32/8000_2.png) [@jwilson25](https://forum.code.org/u/jwilson25)\
**Post date:** [April 23, 2025, 7:08pm UTC](https://forum.code.org/t/sprite-width-and-height-unaffected-by-scale-value/40693/1 "2025-04-23T19:08:47Z")

</div>

Hi,

[This project](https://studio.code.org/projects/gamelab/uv82Srqbz-UYtl3h1tHYzg) shows that a sprite’s width and height are NOT affected by the scale of the sprite. The width and height seem to reflect the ORIGINAL width and height and not the ACTUAL width and height of the scaled sprite.

You can see that I display sprite.width and sprite.height and it does not change when the scale changes.  
I also display (sprite.width \* sprite.scale) and (sprite.height \* sprite.scale), which I reflects the actual size of the sprite.

Is this the way it is supposed to work? The documentation for width and height do not mention this.

John

---

<div class="post-metadata">

**Author:** ![melynn](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/melynn/32/4925_2.png) [@melynn](https://forum.code.org/u/melynn)\
**Post date:** [April 24, 2025, 1:43am UTC](https://forum.code.org/t/sprite-width-and-height-unaffected-by-scale-value/40693/2 "2025-04-24T01:43:49Z")

</div>

Hi @jwilson25,

I looked at the [documentation for scale](https://studio.code.org/docs/ide/gamelab/expressions/scale) and I think this is what you were looking for:  
" _If sprite is scaled, [`sprite.width`](https://studio.code.org/docs/gamelab/sprite.width/) and [`sprite.height`](https://studio.code.org/docs/gamelab/sprite.height/) are not changed. Use `getScaledWidth()` and `getScaledHeight()` instead_."

Does this answer your question - how to access a scaled height and width?  
~Michelle

---

<div class="post-metadata">

**Author:** ![jwilson25](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/jwilson25/32/8000_2.png) [@jwilson25](https://forum.code.org/u/jwilson25)\
**Post date:** [April 24, 2025, 1:30pm UTC](https://forum.code.org/t/sprite-width-and-height-unaffected-by-scale-value/40693/3 "2025-04-24T13:30:48Z")

</div>

Yes! Thank you for double checking me on this. I don’t know how I missed that. Thank you.

---

<div class="post-metadata">

**Author:** ![jwilson25](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/jwilson25/32/8000_2.png) [@jwilson25](https://forum.code.org/u/jwilson25)\
**Post date:** [April 24, 2025, 1:57pm UTC](https://forum.code.org/t/sprite-width-and-height-unaffected-by-scale-value/40693/4 "2025-04-24T13:57:56Z")

</div>

Michelle,

I now realize why I missed this. The documentation you found is for the **scale** property. That’s not a bad place to put it, but I think it should also be in the documentation for the **width** and **height** properties as well.

Also, does something have to be included in order to use getScaledWidth() and getScaledHeight()?

---

<div class="post-metadata">

**Author:** ![mwood](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/mwood/32/4941_2.png) [@mwood](https://forum.code.org/u/mwood)\
**Post date:** [April 28, 2025, 1:44am UTC](https://forum.code.org/t/sprite-width-and-height-unaffected-by-scale-value/40693/5 "2025-04-28T01:44:44Z")

</div>

To use getScaledWidth() and getScaledHeight(), you just need the sprite name and a . (dot) before the command as per the [documentation here](https://studio.code.org/docs/ide/gamelab/expressions/getScaledHeight).

Hope this helps!

Mike

---

<div class="post-metadata">

**Author:** ![jwilson25](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/jwilson25/32/8000_2.png) [@jwilson25](https://forum.code.org/u/jwilson25)\
**Post date:** [April 28, 2025, 2:02am UTC](https://forum.code.org/t/sprite-width-and-height-unaffected-by-scale-value/40693/6 "2025-04-28T02:02:13Z")

</div>

Thanks, Mike. I didn’t realize it is a sprite property. That makes it clear

John

John Wilson

Computer Science & Math Teacher

Park Slope Collegiate
