procedure TForm1.DGCScreen1Flip(Sender: TObject);
:
:
:
:
//Draw and update the players ship based on a collision test.
//Image[0] = Invader, Image[1] = Players Ship. If the collision
//test is True then draw the all white ship (Images[2]) otherwise
//draw the normal ship (Images[1])
if DGCScreen1.Images[0].CollisionTest(x, y, DGCScreen1.Images[1],
px, 450, True) then
Killduration := 10;
if KillDuration > 0 then
begin
DGCScreen1.Back.Draw(px, 430, DGCScreen1.Images[2], True);
Dec(KillDuration);
end
else
DGCScreen1.Back.Draw(px, 430, DGCScreen1.Images[1], True);
//Update the Ship position based on the arrow keys
if (DGCScreen1.KeyDown(VK_LEFT)) and (px > 2) then
Dec(px, 2)
else
if (DGCScreen1.KeyDown(VK_RIGHT)) and (px < 605) then
Inc(px, 2);
end;
|