Re: reducing lag in a bgt game?
My clock class actually counts frames for you, as well, so if you use that, instead of keeping your own counter for everything that needs one, you can do something like:
// Enemies:
enemy@[] enemies;
// A tile map:
tile@[][] map;
// Set up the clock: clock fps(60); void main() { // <...> while (true) { // Do everything that you need to do. step_game(fps.delay); fps.tick(); } } void step_game(double delay) { // Update the enemy for this frame: step_enemy( enemies[fps.frame%enemies.length()], delay ); // Update this column of the map: uint x=fps.frame%map.length(); for(uint y=0; y<map[x].length(); y++) { update_tile(x, y); } }
_______________________________________________ Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector