Re: developing a kind of radar?
For BGT, I wrote a clock class that takes care of the timer shenanigans. All you need to specify is how much time should pass between the start of each frame.
A main function might look like this:
void main() {
clock fps(50); // The constructor takes frames/second as a parameter and determines the delay for you.
double frametime=fps.delay; // This is the target time that passes between frames.
show_game_window("Game with frames"); while(true) { keycheck(); step_game(frametime); update_other_things(frametime); fps.tick(); } }
In practice, I'd include a method (I usually call it step) that takes the amount of time that passes as a parameter, for each class that needs time-sensitive updating. Enemies and radars both fall into this category. You could use an interface for tickable objects, but I don't see the need for it most of the time.
_______________________________________________ Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector