Flipping Sprite Sheet Animation Shrinks Image

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Sammm
Prole
Posts: 37
Joined: Fri Sep 09, 2022 4:39 pm

Flipping Sprite Sheet Animation Shrinks Image

Post by Sammm »

Hello!

I'm trying to make a player animation, but the spritesheet only faces one way. In order to flip the animation, I tried doing

Code: Select all

player.anim:draw(player.spritesheet, player.body:getX(), player.body:getY(), nil, 5, 1, -1)
(notice the last two parameters), but the image just looks shrunken and smashed down, as seen from the image.
Screenshot 2022-09-14 8.16.44 PM.png
Screenshot 2022-09-14 8.16.44 PM.png (1.55 KiB) Viewed 1146 times
How can I prevent this and flip the image/animation normally?

Thanks!
Lua is LÖVE, lua is life
User avatar
ReFreezed
Party member
Posts: 612
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

Re: Flipping Sprite Sheet Animation Shrinks Image

Post by ReFreezed »

You gotta at least show the code for the :draw() function. There is no such thing as a "spritesheet" object in LÖVE or Lua, so there's no way for us to know what the problem is without seeing more of the code.
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
User avatar
pgimeno
Party member
Posts: 3544
Joined: Sun Oct 18, 2015 2:58 pm

Re: Flipping Sprite Sheet Animation Shrinks Image

Post by pgimeno »

Why is that 5 there?

I don't know the signature of player.anim:draw, but if it's similar to love.graphics.draw, angle should be 0 rather than nil, and then the scale should come next. It looks like you're using 5 for horizontal scale, 1 for vertical scale, and -1 for origin X. That would explain the weird aspect of your image, I suppose.
User avatar
Sammm
Prole
Posts: 37
Joined: Fri Sep 09, 2022 4:39 pm

Re: Flipping Sprite Sheet Animation Shrinks Image

Post by Sammm »

Pgimeno, thanks you solved it. The tutorial I watched said that you only needed to fill in 1 scale parameter, which works most of the time, but I guess if you put in parameters after the scale parameter, it messes things up. I filled both the sx and sy parameters and now it works. Thanks!
Lua is LÖVE, lua is life
Post Reply

Who is online

Users browsing this forum: No registered users and 36 guests