Hi, all-- for the life of me I can’t find anything in the docs about how to retrieve the width or height of a sprite. Anybody got any ideas?
Thanks!
Bryan
Hi, all-- for the life of me I can’t find anything in the docs about how to retrieve the width or height of a sprite. Anybody got any ideas?
Thanks!
Bryan
print(go.get("#sprite", "size"))
print(go.get("#sprite", "size.x"))
print(go.get("#sprite", "size.y"))
For the Defold logo that comes with blank projects
DEBUG:SCRIPT: vmath.vector3(128, 128, 1)
DEBUG:SCRIPT: 128
DEBUG:SCRIPT: 128
Oh my God…if they just had ‘size’ on the ‘Property’ tab of a sprite object, I could’ve saved hours of my life.
There’s ‘Position’ and ‘Rotation’, etc…but no ‘Size’-- of course, I should have guessed that would be the name of the property…weird that it’s not there, though…
Thanks!
Bryan
You cannot change the size of a sprite from the editor or at run-time since it is a read-only property. You can however change the scale.
Yeah, I was just trying to read the dimensions…
Bryan