Sprites bug on NexusOne, Sensation, Galaxy Tab, but not on iPhone

So I have 2 sprite sheets files: 1024x1024 and 512x512. The 512x512 is the half size version of 1024x1024.

I’m using display.newSprite() method for the animations.

The animations looks ok on the high resolution devices and tablets (using the 1024x1024 file). It also looks fine on iPhone view (using the 512x512 file).

The only problem is when switching to NexusOne, Sensation, Galaxy Tab views (they all use the lower resolution file). A tiny black line appears at the top of the animation, because it doesn’t crop the frame from the sprite at the exact dimensions (as iPhone view does) set in the options, resulting in getting pixels from the above frame.

I only tested in the simulator since I don’t own any of those android devices. Is it just a simulator bug? Did anyone else experience with this issue? [import]uid: 70003 topic_id: 32889 reply_id: 332889[/import]

Hi,

I had a similar problem once:

My sprites on the high resolution spritesheet e.g. 1024x1024 were positioned sometimes on odd positions, e.g. x = 101, y = 201, etc.

When scaled down you get strange pixel positions like 50.5, 100.5 for your sprites in the lowres spritesheet. Because of this I had some dirty edges in my sprites.

I now always position my sprites on positions dividable by 4, because you might want to use retina artworks sometime:

If you only use even positions you will still get a problem:

Retina Position: y= 102
Highres: y = 51
Lowres: y = 25.5

So better use positions dividable by 4, e.g.

Retina Position: y= 104
Highres: y = 52
Lowres: y = 26

Hope this helps,
best,
Andreas
[import]uid: 107675 topic_id: 32889 reply_id: 130801[/import]

Hi,

I had a similar problem once:

My sprites on the high resolution spritesheet e.g. 1024x1024 were positioned sometimes on odd positions, e.g. x = 101, y = 201, etc.

When scaled down you get strange pixel positions like 50.5, 100.5 for your sprites in the lowres spritesheet. Because of this I had some dirty edges in my sprites.

I now always position my sprites on positions dividable by 4, because you might want to use retina artworks sometime:

If you only use even positions you will still get a problem:

Retina Position: y= 102
Highres: y = 51
Lowres: y = 25.5

So better use positions dividable by 4, e.g.

Retina Position: y= 104
Highres: y = 52
Lowres: y = 26

Hope this helps,
best,
Andreas
[import]uid: 107675 topic_id: 32889 reply_id: 130801[/import]

Hi,

Thanks for the reply (didn’t expect to get any answer on this lol). So I tried your idea, and it kind of worked.

The original code was:
sprite.y = display.contentHeight - 150

I modified to:
sprite.y = display.contentHeight - 148 (multiple of 4)

This fixed NexusOne and Sensation.

Then I modified to:
sprite.y = display.contentHeight - 152 (multiple of 8)

And GalaxyTab was fixed too.
The thing is that I don’t scale down, I only scale up. The virtual dimensions are those of the iPhone (that’s why it looks ok). But the other low resolution have a different aspect ratio and that’s where those half pixel come from in my case.

But it shouldn’t really affect the dimension of the frames taken from the sprite sheet. My guess is that it happens because of the algorithm chosen for pixel approximation. I’ll submit a bug report on this in the next days. [import]uid: 70003 topic_id: 32889 reply_id: 131096[/import]

Hi,

Thanks for the reply (didn’t expect to get any answer on this lol). So I tried your idea, and it kind of worked.

The original code was:
sprite.y = display.contentHeight - 150

I modified to:
sprite.y = display.contentHeight - 148 (multiple of 4)

This fixed NexusOne and Sensation.

Then I modified to:
sprite.y = display.contentHeight - 152 (multiple of 8)

And GalaxyTab was fixed too.
The thing is that I don’t scale down, I only scale up. The virtual dimensions are those of the iPhone (that’s why it looks ok). But the other low resolution have a different aspect ratio and that’s where those half pixel come from in my case.

But it shouldn’t really affect the dimension of the frames taken from the sprite sheet. My guess is that it happens because of the algorithm chosen for pixel approximation. I’ll submit a bug report on this in the next days. [import]uid: 70003 topic_id: 32889 reply_id: 131096[/import]