Hi,
I have a background image that is larger than the viewport.
I have an object that when I touch it will move the background.i.e. I move the object with the finger on the x axis, when it reaches 320px it begins to scroll the screen in that direction.
I have this working fine for both x and y axis’.
My problem I found out is that the background will only scroll in the 0,45,90 and 135 degree angles.
I need it to scroll 360 degrees, for example.
I move my object toward 15 degrees , the background image should scroll at 15 degrees.
I am not using groups as I will hit the physics limitations with my overall goal.
Any help would be great, I did have a look at the way a joystick does this but it became a little fuzzy.
Thank you
EDITED to add, I can move the background in what seems like 8 positions N,NE,E.SE,S,SW,W,NE
Here is some code I am using to move the object in the X axis, the object(player) is moved using standard touch listener.
[lua]
local playerTravel
local multiplier
local playerTravel = player.x
local multiplier = -1
if player.x <= 450 then scrollSpeedX = 0
else
scrollSpeedX = (playerTravel / 600) * multiplier
end
if background.x
then
background.x =
background.x + scrollSpeedX
end
if player.x <= 50 then playerTravel = 480 - player.x
multiplier = 1
scrollSpeedX = (playerTravel / 300) * multiplier
end
if background.x
then
background.x =
background.x + scrollSpeedX
end
[\lua]