Mysterious Unwanted Sprite Offset

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
Candall
Prole
Posts: 19
Joined: Sat Oct 31, 2009 1:09 pm

Mysterious Unwanted Sprite Offset

Post by Candall »

That's right, folks. I have a MUSO on my hands.

So... hi there, first of all. This is my first LUA project, and it's going fairly well so far.

Here's a brief rundown of what I'm doing: I have a script that draws (well, will draw) people to the screen by assembling individual body parts to the right coordinates. The point of this is to allow things such as clothing changes on the fly without having to make more animations.

Now, the problem is that when I flip all of the body parts (by scaling them 1*-1), the torso... for no apparent reason... jumps to the right by ten or fifteen pixels. If I do away with the *-1 that flips the torso, there is no offset. Even when the torso is offset, the biceps and thighs... whose positions are based pretty strictly on the position of the torso... are not offset. I'm sure of two things: Whatever the problem is, it's a stupid, lame oversight... and that I'm going to look and feel like an idiot when it's resolved... but I've re-read my code a million times and for some reason I still can't see it.

Since my work so far is bare-bones and most of it is placeholder anyway, I have no problem with just attaching the .love file.

Any information leading to the arrest of this bug will be rewarded with immense gratitude. Any part of my code that doesn't make sense will be happily explained on the asking.
Attachments
argh.love
(3 KiB) Downloaded 101 times
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Mysterious Unwanted Sprite Offset

Post by bartbes »

This is a bug in 0.5.0
Candall
Prole
Posts: 19
Joined: Sat Oct 31, 2009 1:09 pm

Re: Mysterious Unwanted Sprite Offset

Post by Candall »

Oh. Well.

Hmm.

Okay, well, I guess there must be a work-around, then, because this hasn't been happening the whole time. I'll play around with different sizes for the torso (since that's the only variable between "it's working" and "now").

Thanks for the info!
User avatar
Fizzadar
Prole
Posts: 30
Joined: Mon Oct 26, 2009 6:18 pm

Re: Mysterious Unwanted Sprite Offset

Post by Fizzadar »

Rather than working around, why not just use a 0.6 build? I'm using it and haven't had any issues so far, seems 100% stable.
Candall
Prole
Posts: 19
Joined: Sat Oct 31, 2009 1:09 pm

Re: Mysterious Unwanted Sprite Offset

Post by Candall »

Okay, you talked me into it.

So I'm halfway into porting this thing and all of my sprites are drawing stark white with no alpha data. Is this something that'll be fixed in the stable release, or is there something different about "draw"?
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Mysterious Unwanted Sprite Offset

Post by bartbes »

I think this is related to the size of the images, my guess is that the width and/or height are not a power of 2. Some videocards/drivers can't handle this and just.. draw weird data. In the period before a function has been made to accommodate for this (by padding), you can pad the images yourself.
Candall
Prole
Posts: 19
Joined: Sat Oct 31, 2009 1:09 pm

Re: Mysterious Unwanted Sprite Offset

Post by Candall »

Yup! That was it. Thanks!

I was puzzled because it wasn't happening before I ported from 0.5.0. New graphics system?
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Mysterious Unwanted Sprite Offset

Post by bartbes »

No, just stopped padding automatically (it might've been the padding that caused the incorrect mirroring in the first place)
Post Reply

Who is online

Users browsing this forum: No registered users and 62 guests