as i've seen @ quite few website, best way handle variable frame rate , movement (moving projectiles, monsters, swinging swords)... looks this:
position += totalspeed * (float)gt.elapsedgametime.totalseconds;
and in game's main constructor (game1.cs):
isfixedtimestep = false; targetelapsedtime = timespan.fromseconds(16.666); //16.666 milliseconds, or 60 fps. graphics.synchronizewithverticalretrace = true;
i started notice whenever fps @ 30, projectiles (in case, arrows) move slower when @ full speed. turning v-sync false above unlocked frame rate i'm going around 120 fps. projectiles going faster.
unfortunately, applies else.
am doing wrong, or totalseconds unreliable/broken? plan switch on monogame eventually, i'm not sure if fix issue.
thanks in advance.
Comments
Post a Comment