Closed leonardo2204 closed 7 years ago
Your approach is perfectly valid and a reasonable way to handle things. Frame rate is not really applicable; it’s mainly an artifact of display systems that continuously update. GAMBY updates only occur when explicitly called by the sketch, and only the portions of the screen that need updating are changed. In any case, generally speaking, game logic should generally not be tied to frame rate, since the rate can vary — especially on a slow microcontroller like that in an Arduino. Game timing should be based on the clock.
On Dec 17, 2016, at 10:55 PM, Leonardo Ferrari notifications@github.com wrote:
Hey @logicalzero https://github.com/logicalzero, I was wondering if a setFrameRate function would be a good option to the lib. I've started porting rund.ino, a dino chrome game that was written to arduboy. The problem is, I'm not sure how to handle the "FPS" part of the game. The solution I came up with (which sucks btw) is:
void loop() { if (playing) {
if (millis() > timeToDraw) { .... do all the coding stuff timeToDraw = millis() + gameSpeed; }
Is there a better approach to that ?
Thanks
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/logicalzero/gamby/issues/7, or mute the thread https://github.com/notifications/unsubscribe-auth/AAhZXO7VDnKSm9Pv2E6oiJkyu4uQN-TYks5rJK64gaJpZM4LQCve.
Ok, so I'll keep this up. Thanks for the tips !
Hey @logicalzero, I was wondering if a setFrameRate function would be a good option to the lib. I've started porting rund.ino, a dino chrome game that was written to arduboy. The problem is, I'm not sure how to handle the "FPS" part of the game. The solution I came up with (which sucks btw) is:
Is there a better approach to that ?
Thanks