In my game i have multiple layers to help give depth, as far as the X axis is concerned it seems to work fairly well. Where i have problems is on the Y axis. when my player jumps i would like the background layers to move slightly down. but as of now i can only get them to move up when the player jumps. somehow i cannot wrap my mind around how this needs to be coded to make a display group move the opposite direction of the players jump. here is what i have going on.
local function moveCamera()
if Tm.cameraActive == true then
if (Tm.tireObject.x \> 0 and Tm.tireObject.x \< 8500) then
gameScreen.x = -Tm.tireObject.x + 80
foreGround.x = -Tm.tireObject.x + 80
backgroundGroup.x = -Tm.tireObject.x / 8
farGroup.x = -Tm.tireObject.x \* 0.2
midGroup.x = -Tm.tireObject.x \* 0.4
closeGroup.x = -Tm.tireObject.x \* 0.6
end
if (Tm.tireObject.y \> 0 and Tm.tireObject.y \< 3000) then
gameScreen.y = -Tm.tireObject.y + 220
foreGround.y = -Tm.tireObject.y + 220
backgroundGroup.y = -Tm.tireObject.y \* 0.5
farGroup.y = gameScreen.y
midGroup.y = -Tm.tireObject.y \* 0.5
closeGroup.y = -Tm.tireObject.y
end
end
end
as you can see “tireObject” is the Player that the camera follows. any suggestions would be great thanks [import]uid: 19620 topic_id: 8130 reply_id: 308130[/import]