Necessary with power of 2 on all sprites?

Hello i was wondering i have a sprite that i want to be a little bigger than 256 pixels but not 512 and if i make it in between when its not power of 2 anymore. And i know that it is recommended to make sprites in power of 2 but is it necessary? Because i get the problem that my hitbox is larger then the actual sprite?

Kind regards

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited November 2014

    @inkoqnito@icloud.com said:
    Hello i was wondering i have a sprite that i want to be a little bigger than 256 pixels but not 512 and if i make it in between when its not power of 2 anymore.

    An image that is bigger (even by a single pixel) than a particular powers-of-2 value will use up the same RAM as the next higher powers-of-2 value.

    So, a 258 x 258 pixel image (just 2 pixels over 256) will occupy 512 x 512 pixels worth of memory . . . or a chunk of memory around 400% larger than if you were to trim off those 2 pixels from each dimension, so quite a difference in RAM usage (when spread across a whole game's worth of images) and more image for the target device's processor to handle.

    @inkoqnito@icloud.com said:
    And i know that it is recommended to make sprites in power of 2 but is it necessary?

    No, it is not necessary.

    @inkoqnito@icloud.com said:
    Because i get the problem that my hitbox is larger then the actual sprite?

    The resolution of your image has no effect on the 'hitbox' (the actor).

  • @Socks said:
    The resolution of your image has no effect on the 'hitbox' (the actor).

    thanks for all the answers but i think you misunderstood the last, i have made an image of 512x512 but the actual sprite/image aren't that big so are som white/alpha around. And because of this the hitbox starts earlier than the actual image=)

    kind regards

  • SocksSocks London, UK.Member Posts: 12,822
    edited November 2014

    @inkoqnito@icloud.com said:
    . . . i have made an image of 512x512 but the actual sprite/image aren't that big so are som white/alpha around. And because of this the hitbox starts earlier than the actual image=)

    Ah, I see, thanks for the clarification.

Sign In or Register to comment.