Hello all,
Issue:
I am having an issue while moving a display group object using “transition.to”.
I have several tiles within a display group, which I call " map_tile_group".
In the first image , you will see a blue circle in the center of the screen. This is my player/camera center point. It stays in the center of the screen at all times ( it appears off-center because of how I took the screen shots ). The green, tan and blue tiles are just random tiles to help me track movement smoothness.
In the second image , you will see that the player has moved down and to the right ( really the map_tile_group has moved up and to the left ). You will also see my issue. When the map_tile_group is moved, each of the tiles appear to have some sort of spacing between them. To me, it seems that each of the child objects ( tiles ) are not being moved in a way that places them next to one another properly.
Code Snippets :
Movement:
function Camera\_Controller.move\_camera() ... ... speed = 100 --camera speed transition.to( map\_tile\_group , { x=map\_tile\_group.x-x, y=map\_tile\_group.y-y, time=speed } ) ... ... end
the x and y variables here are just my way of determining the direction map_tile_group should move based on the keys I press. Further explanation of them should not be necessary for this inquiry.
Triggering Movement:
Basically, I have tried two methods of triggering the movement of _ map_tile_group _:
1. A Runtime listener using “enterFrame”
2. A repeating function that runs at a variable time interval
Code from each method is shown below:
1.
Runtime:addEventListener( "enterFrame", Camera\_Controller.move\_camera )
2.
Camera\_Controller\_Reapeater\_Timer = 100 function Camera\_Controller\_Loop() Camera\_Controller.move\_camera() Camera\_Controller\_Reapeater() end function Camera\_Controller\_Reapeater() timer.performWithDelay( Camera\_Controller\_Reapeater\_Timer, Camera\_Controller\_Loop ) end timer.performWithDelay( Camera\_Controller\_Reapeater\_Timer, Camera\_Controller\_Reapeater )
Attempted Solutions :
I have changed the speed of the Camera_Controller_Reapeater_Timer to match the “speed” variable found in Camera_Controller.move_camera() along with changing it to a slightly higher number to allow for processing time.
A solution I have found it to not use the _transition.to method at all, but instead move the map_tile_group _ x and y value directly as so:
map\_tile\_group.x = map\_tile\_group.x-x map\_tile\_group.y = map\_tile\_group.y-y
Doing this removes the tile spacing problem as described in Issue , but doing so produces a slight but noticeable amount of jitter/lag. I have moved the _ map_tile_group _ by increments of 1 pixel up to 50 in testing with the same jitter/lag being present.
My PC is quite high in it’s specs, so CPU/graphics card concerns should be null.
I look forward to hearing people’s thoughts.