Get size of an animated sprite?

Jamie-CJamie-C Posts: 10Member

Is there a way to get the size of an animated sprite? I see in the docs you can get the texture size of a non-animated sprite but that doesn't seem to be an option for animated sprites.

Best Answer


  • MegalomaniakMegalomaniak Posts: 2,032Admin
    edited March 2018

    If your sprite is a sprite sheet you should be able to get the node size and divide the x and y dimensions by the tile amounts, no?

  • Jamie-CJamie-C Posts: 10Member

    It's not a sprite sheet, it's just three individual frames. I want use the size so I can clamp its location and keep it from leaving the screen. I can do this using exact number (which I know), I was just hoping to find something more modular so I didn't have to hard code in the size of my sprite node.

  • MegalomaniakMegalomaniak Posts: 2,032Admin

    So, why can't you get node size? Are your frames different resolution(and if so, why)?

  • Jamie-CJamie-C Posts: 10Member

    I don't see an option to get the size of a node, am I missing something? I thought a node was essentially just a point in space and wouldn't have a specific size.

  • MegalomaniakMegalomaniak Posts: 2,032Admin
    Accepted Answer

    Depends on the type. I meant any kind of size with that. In sprites case I think the following post might answer:

  • Jamie-CJamie-C Posts: 10Member

    Thanks, it seems you can get the size of a texture for a sprite but not an animated sprite since I guess the texture is likely to change sizes per frame. I am able to work around my issue so I'll make this as answered. Thanks for taking the time.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file