Issue with the SourceY being different in some of the sprites

2 replies [Last post]
vik_b_it
User offline. Last seen 11 weeks 5 days ago. Offline
Joined: 7 Jun 2011

Hi guys,

Very new to TP and am currently evaluating it at the moment. Looks like a great product.
But I am having an issue when I publish the sprite sheet..

TP creates a data file, and in the data file some of the Y values are different as shown below

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 {
            -- dog_wakesup_00020
            x=600,
            y=0,
            width=200,
            height=86,
 
            sourceX = 82,
            sourceY = 630,
            sourceWidth = 1024,
            sourceHeight = 768
        },
        {
            -- dog_wakesup_00021
            x=200,
            y=88,
            width=200,
            height=88,
 
            sourceX = 82,
            sourceY = 628,
            sourceWidth = 1024,
            sourceHeight = 768
        },

As you can see the sourceY is different. If I leave the sourceX and Y in the data file, the animation looks great. But because I want to move the animation around the screen using the X and Y properties I take out the SourceX and SourceY from the file. As soon as I do this, the animation gitteres a bit.

Is there a setting I am missing I have to set up before I export? any help would be appreciated.

Thanks

Vik

Replies

Brent Sorrentino
User offline. Last seen 58 min 29 sec ago. Offline
Staff
Joined: 28 Nov 2012

Hi Vik,
Once you have the sprite on the screen, moving it around by x and y values is the same as any display object, with the x/y being (by default) the center of the sprite. When you're looking at the data TexturePacker exports, the "x" and "y" values pertain to where those frames reside on the image sheet... they aren't related to the position of the sprite on the screen once it's output as a display object. Does that clarify things a bit?

Best regards,
Brent

vik_b_it
User offline. Last seen 11 weeks 5 days ago. Offline
Joined: 7 Jun 2011

Brent,

so what does the SourceX and SourceY attributes do?

also the last post I did on https://developer.coronalabs.com/forum/2012/12/30/dynamic-sprite-sheets
when I try to center the sprite on the screen, it just puts it in the botton left of the screen...

Vik

Viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.