flip images?

BlitzMax Forums/BlitzMax Beginners Area/flip images?

yzzm(Posted 2009) [#1]
is there a way to flip an image so that a character that's facing left would then be facing right?


GfK(Posted 2009) [#2]
SetScale -1,1
DrawImage charFacingLeftImage,x,y



xlsior(Posted 2009) [#3]
Likewise, you can turn it upside-down by SetScale 1,-1


_Skully(Posted 2009) [#4]
You can also make it backwards, upside-down and squished by SetScale -1,-0.3

:)


Zacho(Posted 2009) [#5]
I had a way of doing this but it involved saving a new picture with the character facing backwards. So whenever I pushed 'S' for example, the character-facing-backward's image would show up, not the one facing forward.


GfK(Posted 2009) [#6]
I had a way of doing this but it involved saving a new picture with the character facing backwards.
That's not very efficient if the flipped image is identical (save for being flipped, of course).


xlsior(Posted 2009) [#7]
I had a way of doing this but it involved saving a new picture with the character facing backwards.


Big downside of that is that you need two copies of the images in question in video memory, which may raise the minimum requirements of your game (e.g. doing a setscale using the same image your game may still work on a videocard with 32MB videoram, but using an extra image may push it just beyond that)

Also, either you'll have an initial slowdown to create the flipped image on the fly, or you'll increase the size of your game download by needlessly including additional media for the flipped versions...

Instead, pressing 'S' could set a variable (e.g. 'flipsprite=true'), and in your drawing yroutine you put a 'if slipsprite=true then setscale -1,1' to do the flipping