Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

8 years 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?

8 years ago by mdkess

Thinking about this more - I guess my real question is, how do I deal with entities whose collision bounds are smaller than the animation itself?

I'm finding this especially difficult since my model is too tall, but (x, y) = (0, 0) is the top left corner, so I can't just set size.x and size.y to what they should be.

Je ne c'est pas.

8 years ago by drhayes

Just to throw something out there... have you looked at offset?

8 years ago by mdkess

That's exactly what I needed! Thanks!
Page 1 of 1
« first « previous next › last »