Issue with transitions and lots of sprites

I have been experiencing some issues in Lime with transitions so have made a very simple demo just to illustrate this outside of Lime.

You can download the demo here - http://dl.dropbox.com/u/571145/TransitionIssues.zip

All I am doing in it is position some sprites from a sprite sheet and then move them from right to left and back again. As you can will see there are some weird visual issues going on where the tiles sort of seem to jump slightly.

If you change “useTransitions” on line 4 to false you will see that the issues don’t occur when I move the group manually.

Anyone know why this might be happening or know a way to fix it? [import]uid: 5833 topic_id: 8360 reply_id: 308360[/import]

easy answer there…

try doing this in your transitioned version

[lua]function onEnterFrame()
print(map.world.x)
end

Runtime:addEventListener(onEnterFrame)[/lua]

not whole numbers!

try transitioning a custom variable eg [lua]xpos[/lua] instead of x and then running an enterFrame function that sets eg [lua]map.world.x = round(map.world.xpos)[/lua]

you’ll need to implement a suitable rounding function… i’m not sure if you’ll want ceil or floor or round eg http://lua-users.org/wiki/SimpleRound

but since it’s rounded you will always see the occasional jump because your distance won’t always the same like it is with your non-transitioned version

not sure why you’d use want to use transition anyway?

j [import]uid: 6645 topic_id: 8360 reply_id: 29888[/import]

I use rounding for moving the map without transitions in other places, I had tried to do it for transitions as well but I may have messed up, I will give it another go.

The transitions are just to make it easier to move the map in a fire and forget style fashion. [import]uid: 5833 topic_id: 8360 reply_id: 29893[/import]

J you are, as always, awesome!

I had tried rounding the position during the transition, that didn’t work. I then tried your solution of transitioning a custom value, rounding that and then setting the position from that and it works awesomely! [import]uid: 5833 topic_id: 8360 reply_id: 29897[/import]

good to hear.

re rounding: i use [lua]math.floor(n+0.5)[/lua]

[lua]function round(num)
local r = math.floor(num+0.5)
return r
end

for n=0, 1, 0.1 do
print(n,round(n))
end

0 => 0
0.1 => 0
0.2 => 0
0.3 => 0
0.4 => 0
0.5 => 1
0.6 => 1
0.7 => 1
0.8 => 1
0.9 => 1
1 => 1[/lua]
[import]uid: 6645 topic_id: 8360 reply_id: 29899[/import]

That’s pretty much what I use too, I only used the other function in that sample just to make sure it wasn’t something to do with the method I was using for rounding.

Thanks again! [import]uid: 5833 topic_id: 8360 reply_id: 29903[/import]