Вот пытался уменьшить кол-во вычислений... вроде меньше стало, а ФПС такойже остался... значит дело не в кол-ве вычислений...
program Tanks;
var
GameFF: array[1..30, 1..30] of integer;
MO: array[0..10] of image;
FieldW,FieldH:integer;
ScreenW,ScreenH:integer;
i,j,t,xc,yc,xc1,yc1: integer;
SXPos,SYPos,XMax,YMax: integer; { Position Screen on Map }
DXPos,DYPos: integer;
MXPos,MYPos: integer;
StageRes: resource;
Tank1: array [1..4] of image;
UTT:integer; { Type of Tank for User }
UXPos,UYpos: integer; { UserPosition on Area }
FPS_LastCount,FPS_Count,MS,MSL: integer;
begin
{ Setting Constants }
SXPos:=1;
SYPos:=1;
DXPos:=SXPos/16;
MXPos:=-(SXPos mod 16)-16;
DYPos:=SYPos/16;
MYPos:=-(SYPos mod 16)-16;
ScreenW:=GetWidth/16+1;
ScreenH:=GetHeight/16+2;
FieldW:=30;
FieldH:=30;
XMax:=FieldW*16-ScreenW*16;
YMax:=FieldH*16-ScreenH*16;
{ Loading Stage 1 }
{ Setting Stage Constants }
UXPos:=32;UYPos:=32;
{ Loading Images }
MO[1]:=loadimage('/Wall1.png');
MO[0]:=loadimage('/Floor1.png');
Tank1[1]:=loadimage('/tank1.png');
Tank1[2]:=loadimage('/tank2.png');
Tank1[3]:=loadimage('/tank3.png');
Tank1[4]:=loadimage('/tank4.png');
{ Loading Map }
StageRes:=OpenResource('/stage1.tt');
if ResourceAvailable(StageRes) then begin
for i:=1 to 30 do for j:=1 to 30 do begin
t:=readbyte(StageRes);
if t=$3B then begin t:=readbyte(StageRes);t:=readbyte(StageRes);t:=readbyte(StageRes);end;
GameFF[j,i]:=t-$30;
end;
end;
CloseResource(StageRes);
{ Main Loop }
t:=1;
while true do//GetKeyClicked <> KE_STAR do
begin
setcolor(0,0,0);fillrect(0,0,getwidth,getheight); { CLS }
if GetKeyPressed = KE_KEY6 then
Begin
SXPos:=SXPos+t;
DXPos:=SXPos/16;
MXPos:=-(SXPos mod 16)-16;
End;
if GetKeyPressed = KE_KEY4 then
Begin
SXPos:=SXPos-t;
DXPos:=SXPos/16;
MXPos:=-(SXPos mod 16)-16;
End;
if GetKeyPressed = KE_KEY8 then
Begin
SYPos:=SYPos+t;
DYPos:=SYPos/16;
MYPos:=-(SYPos mod 16)-16;
End;
if GetKeyPressed = KE_KEY2 then
Begin
SYPos:=SYPos-t;
DYPos:=SYPos/16;
MYPos:=-(SYPos mod 16)-16;
End;
for i:=1 to ScreenW do
for j:=1 to ScreenH do
begin
xc:=DXPos+i; yc:=DYPos+j;
if (xc>0) and (xc<=FieldW) and (yc>0) and (yc<=FieldH) then
begin
xc1:=i*16+MXPos; yc1:=j*16+MYPos;
drawimage(MO[GameFF[xc,yc]],xc1,yc1);
end;
end;
MS:=GetSecond(GetCurrentTime);
If MS<>MSL Then
begin
FPS_LastCount:=FPS_Count;
FPS_Count:=0;
MSL:=MS;
end
Else
FPS_Count:=FPS_Count+1;
SetColor(255, 255, 255);
DrawText('FPS:'+IntegerToString(FPS_LastCount), 0, 0);
repaint;
end;
end.