SpriteSheet + setReferencePoint = shifted sprites

Do you see any incosistences when using setReferencePoint with spritesheets ?

For example, try the following with uma.png and uma.lua files from HorseAnimation sample project which comes with the new Game Edition. The image seems to be slightly shifted from where it should be.

[lua]require “sprite”
local myspritesheet = sprite.newSpriteSheetFromData( “uma.png”, require(“uma”).getSpriteSheetData() )
local spriteSet = sprite.newSpriteSet(myspritesheet,1,1)
sprite.add(spriteSet,“myAnimation1”,1,1,1000,0)
local spriteInstance = sprite.newSprite(spriteSet)
spriteInstance:setReferencePoint(display.TopLeftReferencePoint)
spriteInstance.x = 0
spriteInstance.y = 0
spriteInstance:prepare(“myAnimation1”)
spriteInstance:play()[/lua]

In other sprites I see even more significant shifts.

I guess uma.lua has been made with Zwoptex, but I get similar incosistencies with TexturePacker spritesheets too. Also, my first thought was that the trimming feature is responsible for this, but I see the inconsistency happening with frames that are not trimmed too. I don’t see anything wrong when using images on their own png file.

Does anybody else face the same problem? Plz try the code with uma.lua or other spritesheets you have available and leave some feedback, so we can find out if it is a Corona bug or not.

Thanks! [import]uid: 7356 topic_id: 3130 reply_id: 303130[/import]

Anybody? [import]uid: 7356 topic_id: 3130 reply_id: 9185[/import]

Hi,

I’m seeing the same behavior and have filed a bug (case #1772). I will investigate for possible workarounds in the mean time.

Thanks for reporting the issue, and sorry for the inconvenience.

Tim [import]uid: 8196 topic_id: 3130 reply_id: 9854[/import]

Thanks Tim !

Just a thought: The issue may be related to differences between the original and the “trimmed” dimensions, which may be internally used for the initial setup of the image origins (but based on the wrong dimension set).

[import]uid: 7356 topic_id: 3130 reply_id: 9875[/import]

@Tim

The issue may be closely connected to this caveat: All the frames in a spritesheet get the dimensions of the 2nd (in the sorted .lua file) frame. [import]uid: 7356 topic_id: 3130 reply_id: 10815[/import]

I’m still seeing this problem. It makes spritesheets useless: I need a dude who can run along the ground. He needs to respect display.BottomCenterReferencePoint, not continually resize around his midpoint.

Has anyone made this work? Specifically:
* one sprite using a spritesheet with different sprite heights
* when different animations are played (using prepare+play), the sprite’s bottom coordinate should remain constant. Not its midpoint.

[import]uid: 98409 topic_id: 3130 reply_id: 61991[/import]

@matt15, I use Spriteloq to generate spritesheet, and it lets me set the reference point when I generate the spritesheet. It makes it really easy to do what you are asking about. If you are using Flash to create animation, and if you can generate SWF file, you should try out Spriteloq. It is super awesome.

Early on, before I tried Spriteloq, I generated series of PNG files, which I manually assembled into a spritesheet, and that was a major pain in the neck, especially when I needed to keep tweaking/updating the image/animation. With Spriteloq, once SWF file is ready, it converts animation into spritesheet in a jiff. And you can pack together different SWF files with different dimensions into a single spritesheet. It’s super easy. [import]uid: 67217 topic_id: 3130 reply_id: 61997[/import]