PDA

View Full Version : Jerky rotation animation with TImageSpriteEx



BigKnockers
19-08-2003, 11:24 AM
I've been toying around with TImageSpriteEX. If I rotate my sprite I notice a jerk every now and then (possible once per rotation). I've kept everything pretty basic like this:

TAsteroid = class(TImageSpriteEx)
XPos, YPos: single;
XSpeed, YSpeed: single;
procedure DoCollision(Sprite: TSprite; var Done: Boolean); override;
procedure DoMove(MoveCount: Integer); override;
end;

with DoMove like this


procedure TAsteroid.DoMove;
begin
inherited;
Angle := Angle + 1;
XPos := XPos + XSpeed;
YPos := YPos + YSpeed;

if XPos > frmMain.DXDraw.SurfaceWidth then XPos := 0;
if YPos > frmMain.DXDraw.SurfaceHeight then YPos := 0;

X := Trunc(XPos);
Y := Trunc(YPos);
end;

then in the timerTimer event I have this:

DXSpriteEngine1.Move(LagCount);
DXSpriteEngine1.Dead;
DXDraw.Surface.Fill(0);
DXSpriteEngine1.Draw;

Am I doing something wrong? If it helps take a look at my

CODE (http://www.knockton.demon.co.uk/spriteex_code.zip)

and / or

EXECUTABLE (http://www.knockton.demon.co.uk/spriteex_exe.zip)

p.s. It only happens which the rock is moving not when it's just sat still rotating, and doesn't seem to happen in fullscreen mode