Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

How to update my code as often as lua updates itself.
Started by jamesewashington98 Mar 24 2019 04:30 AM

No replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

jamesewashington98

[GLOBAL: userInfoPane.html]
jamesewashington98
  • Observer

  • 1 posts
  • Corona SDK

Hi guys, I have a problem. 

I recently moved my game from love2d to corona, and everything seems to be transitioning pretty well. 

 

But I have a Gameupdate() function that I call all my code from, and when I go to update my code, it is only running like 15 times a second.

 

I call it with this:

gameLoopTimer = timer.performWithDelay(1, Gameupdate, 0)

 and This is the Gameupdate function:

local newtimer = os.time()
local loops = 0

function Gameupdate()

	loops = loops + 1
	
	if math.abs(os.time()-newtimer) >= 1 then
		print("################## update loops"..loops)
		loops = 0
		newtimer = os.time()
	end
		
	local dt = GetDt()		
	GameState.Update(dt)
	GameState.Draw()
	
end



Can anyone tell me why it is only running 15 times a second?




[topic_controls]
[/topic_controls]