Scrolling Game Development Kit Forum

SGDK Version 2 => Help, Errors, FAQ => Topic started by: Till on 2009-04-03, 11:22:07 AM

Title: from where to call LimitFrameRate?
Post by: Till on 2009-04-03, 11:22:07 AM
I was one of the people who had the problem with that the game is running too fast. Now I discovered the function LimitFrameRate in GeneralRules. But from where should the function be called?
Title: Re: from where to call LimitFrameRate?
Post by: Vincent on 2009-04-03, 12:25:59 PM
Hi,

Well the important thing to make sure is that this rule is called only once per frame.  So you can put it in one of your map rules.  Alternatively, if you plan to include one (at least one and at max one) particular sprite on each map, you can add the rule in the sprite's rules. 

The whole set of code (each maps' rules and each sprites' rules) is executed once at each frame.  So make sure you just have one LimitFrameRate rule that is executed in all these set of rules and it should work. :)
Title: Re: from where to call LimitFrameRate?
Post by: durnurd on 2009-04-03, 12:48:11 PM
You could also put it on an overlay map, if you happen to plan having one of those around all the time.  Even if you don't, you could make a blank map that executes global rules and use it as the overlay.
Title: Re: from where to call LimitFrameRate?
Post by: Till on 2009-04-06, 08:27:57 AM
thanks for the quick replies. i added a new plan with a rule to the game from where i called the function.