How can I flip an Image? I don't want to double my image count (both directions of my characters are same except being flipped).
You can achieve it by using negative scaling factors, e.g.:
@character.draw(x_pos, y_pos, z_order, -1.0, 1.0) will draw your character unscaled (technically scaled by 1.0 factor) and flipped horizontally.
Notice the image will be flipped relative to right edge, not the center, so you might want to add an offset to your x_pos.
So to flip relative to center do I have to add Image.width/2 or subtract it?
You have to add Image.width, because it's like turning a page in book (couldn't find better explanation :) But this is when you use normal Image.draw.
When you use Image.draw_rot then image doesn't change position (if center is default 0.5), but then it draws centered in given position. If you want to place there the top-left corner, you have to add Image.width/2 and Image.height/2.
Thanks. Figured it on my own, just forgot to update post. Also thanks for tip about draw_rot. Won't use it in my main sprite class, but probably will in particle class that will be inheriting from sprite.
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill