Flipping Sprites

BlitzMax Forums/BlitzMax Beginners Area/Flipping Sprites

Rico(Posted 2010) [#1]
Hi I just did a search and found you can flip a sprite by doing

SetScale -1,1

before you draw it. what will happen with the imagehandle if i do this, will i need to set it again for flipped sprites?


GfK(Posted 2010) [#2]
The image is 'flipped' using the handle as its axis. In 99% of cases you won't need to alter the handle.

(I say 99% because although I can't think of a scenario in which you'd need to reposition the handle, I'm sure someone will be along shortly).


Rico(Posted 2010) [#3]
ahh i see ok, thank you very much gfk. haha yes someone will be along soon.....


ima747(Posted 2010) [#4]
You rang?

It won't make any difference if it's mid point handled, but if you use corner handling or some other custom offset it will come out out of place.
e.g. You use upper left corner as the handle (default unless you use auto mid point). If you draw an image at 0,0 it will be drawn in the upper left corner of the screen. If you setscale(-1, 1) and draw at 0,0 you will draw it off the left side of the screen since it is flipped around it's left edge.

Basically if you plan on playing with scale, or flipping mid handling makes life MUCH easier in many instances.