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.

require "sprite"
local myspritesheet = sprite.newSpriteSheetFromData( "uma.png", require("uma").getSpriteSheetData() )
local spriteSet = sprite.newSpriteSet(myspritesheet,1,1)
local spriteInstance = sprite.newSprite(spriteSet)
spriteInstance.x = 0
spriteInstance.y = 0



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.


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).


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.

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.

@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.

views:1022 update:2011/10/22 9:46:13
corona forums © 2003-2011