Re: DT in BGT

The if(time.elapsed>1000) bit should not happen. If that was in the version I posted (I'm not seeing it on my copies), it was probably to prevent it from getting stuck for debugging something long ago.
The reason dt isn't reporting right is that you defined it as a member variable based on the timer, and the time between the timer starting and dt being defined is less than a millisecond. You'd want to define dt either when setting delay (if you want a fixed dt), or before restarting the timer (if it's based on the timer). I generally just define dt when calling the game's step/update/tick method, and pass it around from there.
The line wait((elapsed>=delay) ? 1 : delay-elapsed); uses the ternary operator. It's one of those things that isn't intuitive if you aren't familiar with it, but saves time when you are.
Basically, this:
a= (b) ? c : d;
is the same as:
if (b) a=c
else a=d;
It's just a sort of shorthand.

_______________________________________________
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : JLove via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : JLove via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : JLove via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : JLove via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : JLove via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : JLove via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : JLove via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : brian . kurosawa via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : brian . kurosawa via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : JLove via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : JLove via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : JLove via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : JLove via Audiogames-reflector

Reply via email to