Recently, I uploaded this game in play store:
https://play.google.com/store/apps/details?id=np.com.techkunja.ascend
What Have I Been Doing:
For this project, I have been using
-> scale = “zoomEven” (to fit all types of devices)
-> fps = 60
-> Using this function to calculate ‘dt’ so that I can add ‘dt’ to my moving background to manage delay
–Delta time
local function getDeltaTime()
local temp = system.getTimer() – Get current game time in ms
local dt = (temp-runtime) / (1000/60) – 60 fps or 30 fps as base
runtime = temp – Store game time
return dt
end
local function setDeltaTime()
dTset = getDeltaTime()
end
-> In each frame…
background.y = background.y + dTset
Problem: The game doesn’t seem smooth. Because of
Sometimes ‘dt’ becomes large due to processes running in device so the background moves skipping greater distance
Things I have Tried:
-> removed implementation of dt which resulted in some black space between two background
What Do I Want To Know:
So, what is the best possible way to show smooth background scrolling?