You should synchronize it with the Framerate, so it will run with exactly the same speed on every computer. This should normally done with all movements...
For this you need the time in seconds since the last Frame (TiElap) in Seconds and extra Single/Float-Koordinates (fVentana_XY) for your Object if Ventana_XY are not already form Type Single. You can controll the Speed of the Object with fUnitsPerSecond.
Code:
if oisButton7 in OmegaInput.Keyboard.States then //DIK_UP
begin
if fVentana_Y > 1.0 then begin
fVentana_Y := fVentana_Y - (TiElap * fUnitsPerSecond);
Ventana_Y := round(fVentana_Y); // only if Omega can't deal with floats
end;
end;
For the timer:
Code:
uses MMSystem; // <-- i'm not sure if you need this
var
{Timer}
TiAvai: Boolean;
TiFreq, TiLast, TiCur: Int64;
TiScal, TiElap: Double;
{High Performance Counter - Initialisation, only once}
TiAvai := false;
if not QueryPerformanceFrequency( TiFreq ) then begin
TiLast := timeGetTime;
TiScal := 0.001;
end
else begin
TiAvai := true;
TiScal := 1 / TiFreq;
QueryPerformanceCounter( TiLast );
end;
{High Performance Counter - Update every Frame}
if TiAvai then
QueryPerformanceCounter( TiCur )
else
TiCur := TimeGetTime;
TiElap := (TiCur-TiLast) * TiScal;
TiLast := TiCur;
// block frames slower than 5 fps to avoid some problems
if (TiElap > 0.2) then TiElap := 0.2;
Sorry for bad english, maybe....
Coolcat