Hey guys I was wandering what would be the best way to use the ‘enterframe’ listener on lots of diferent functions…?
So so for example I want to call a 4 functions as fast as possible; update the score, move the player, move platform, move background. What is the optimized way to write this?
All in one code,
all in seperate functions and called individualy from the one ‘enterframe’ function,
each with their own enterframe call,
or on the last line of each function it calls the next function on the list making a cycle?
At the moment I am using the one enter frame listener and calling all the individual functions
[lua]local movePlatform= function()
end
local movePlayer = function()
end
local updateScoreboard = function()
end
local moveBackground= function()
end
local enterFrame = function()
movePlayer()
movePlatform()
updateScoreboard()
moveBackground()
end[/lua]
Not many calls here, but with time I will be adding more (no doubt) so taking that into account too.