Issue
I've been playing around with sprite animation for the past day or two, and today I encountered an issue dealing with animation smoothness. I've attached an example of what I mean in to this post, for reference. Basically, when moving left the animation is very smooth, but when moving right the animation because much less smooth (moves to the left and right, and doesn't stay as steady). After a few hours of changing various variables, and inspecting my code, I came to the realization that the issue is probably spawned from the fact that the engine pulls the sprites starting from the upper left (x,y) position.
Before I figured out how to mirror sprites in game, I had mirrored them on the sprite sheet. This is what I believe to be causing the difference in animation smoothness.
Inquiry
Does anyone know of a way of preventing this? Am I just overlooking something that is incredibly simple? Any suggestions are appreciated.
Thank you!
Animation Smoothness
-
- Prole
- Posts: 11
- Joined: Thu Feb 21, 2013 3:03 am
Animation Smoothness
- Attachments
-
- game.love
- (436.42 KiB) Downloaded 199 times
- Taehl
- Dreaming in associative arrays
- Posts: 1025
- Joined: Mon Jan 11, 2010 5:07 am
- Location: CA, USA
- Contact:
Re: Animation Smoothness
All I see is a white box. Looks like PO2 Syndrome strikes again! (Wasn't Love 0.8.0 supposed to end that?)
To fix the white box issue, you need to ensure your images have dimensions that are a power of 2. So an image sized 256x512 would be okay, but 200x500 would not. This is the PO2 sequence:
1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, ...
Then again, none of your images are PO2-compliant, so maybe the problem is being caused by your sprite sheet being too big?
To fix the white box issue, you need to ensure your images have dimensions that are a power of 2. So an image sized 256x512 would be okay, but 200x500 would not. This is the PO2 sequence:
1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, ...
Then again, none of your images are PO2-compliant, so maybe the problem is being caused by your sprite sheet being too big?
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
- slime
- Solid Snayke
- Posts: 3163
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: Animation Smoothness
Many old or Intel GMA video cards don't support images with dimensions greater than 2048x2048.
http://feedback.wildfiregames.com/repor ... XTURE_SIZE
http://feedback.wildfiregames.com/repor ... XTURE_SIZE
-
- Prole
- Posts: 11
- Joined: Thu Feb 21, 2013 3:03 am
Re: Animation Smoothness
I went ahead and reduced the image size. It's still not within the parameters for PO2, but I decided to play around with these sprites after I read that it was no longer an issue.
Also, this is an older piece of code, but it highlights the issue more clearly than other examples I could find.
Also, this is an older piece of code, but it highlights the issue more clearly than other examples I could find.
- Attachments
-
- game.love
- (87.36 KiB) Downloaded 189 times
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Animation Smoothness
When I use half the quad's width and height as origin coordinates, it seems to be as smooth, both ways, and the left-to-right movement seems as intended.
-
- Prole
- Posts: 11
- Joined: Thu Feb 21, 2013 3:03 am
Re: Animation Smoothness
When you are referring to origin coordinates, do you mean the origin offset (in love.graphics.drawq)? Since the width and height change, I tried getting the variable directly from the table, but it kept returning nil (attempting to perform arithmetic on a nil value).
I'm fairly new to Lua, would you mind explaining how I could accomplish something like that.
Thank you for your time and patience.
I'm fairly new to Lua, would you mind explaining how I could accomplish something like that.
Thank you for your time and patience.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Animation Smoothness
Quads have a getViewport function which gives the width and height, I used something like
then used w/2 and h/2 for ox and oy respectively.
Code: Select all
local _, _, w, h = currentQuad:getViewport()
-
- Prole
- Posts: 11
- Joined: Thu Feb 21, 2013 3:03 am
Re: Animation Smoothness
That did the job. Thank you for the info!
Who is online
Users browsing this forum: No registered users and 3 guests