1 decade ago by mdkess
I have an animation of my entity attacking, and I'm trying to figure out how to flip it properly.
In terms of collision, this entity is 8x12 pixels in size (width x height). However, the animation for their attack is 16x16 pixels in size, with the entity taking up the bottom left corner of the animation.
When the entity is moving right, everything works fine - I set the entity size to 8x12, I set the animation size to 16x16, and it looks great. However, when the entity is facing left, I'm not sure how to flip the entity - calling currentAnim.flip flips the entity at x = 8, while I really want to flip at x = 4 (ie. have the the size of the entity, not the animation.)
Does anyone know of a way to do this?
In terms of collision, this entity is 8x12 pixels in size (width x height). However, the animation for their attack is 16x16 pixels in size, with the entity taking up the bottom left corner of the animation.
When the entity is moving right, everything works fine - I set the entity size to 8x12, I set the animation size to 16x16, and it looks great. However, when the entity is facing left, I'm not sure how to flip the entity - calling currentAnim.flip flips the entity at x = 8, while I really want to flip at x = 4 (ie. have the the size of the entity, not the animation.)
Does anyone know of a way to do this?