Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / Possible to mirror or flip sprite?
- - By kodywilson Date 2021-05-03 17:47 Edited 2021-05-05 22:04
I'm wondering if it is possible to mirror a sprite in Gosu? One example would be having a player that runs right and left, can you create a right running sprite and then just flip or mirror it for running left?

If not, I will just make left versions, but I thought I would ask before I go down that path.

Thanks and have a good one!

EDIT to add: I cannot seem to get an image to scale when using .draw_rot.

Doing this:

def draw
    @image.draw(@x, @y, @z, scale_x = @scale, scale_y = @scale)
end

works great, I can scale the images no problem.

But this:

def draw
    @image.draw_rot(@x, @y, @angle, @z, scale_x = @scale, scale_y = @scale)
end

does not scale the image at all. Otherwise it behaves as expected (x and y are the center of the image).
Parent - By RunnerPack Date 2021-07-24 20:43
https://rubydoc.info/github/gosu/gosu/Gosu/Image#draw_rot-instance_method

There are "center_x" and "center_y" parameters before the scale parameters.
Up Topic Gosu / Gosu Exchange / Possible to mirror or flip sprite?

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill