Смекни!
smekni.com

Игровая программа (стр. 2 из 3)

Событие таймера:

procedure FNTimeCallBack(uTimerID, uMessage: UINT;dwUser, dw1, dw2: DWORD) stdcall;

var

word:DWORD;

begin

Inc(CountTickTimer);

if (((PressedKey[19]=true)or

(PressedKey[80]=true))and(CountTickTimer>100))and(CountFuel>0) then

if(not Pause) then begin

Pause:=true;

CountTickTimer:=0;

end

else

begin

Pause:=false;

CountTickTimer:=0;

end;

if not Pause then begin

if Selected_Menu_item='Start' then //Нажатаклавиша Start

begin

if SpeedGL.MediaPlayer1.FileName<>'Sound&bsol;Race.mp3' then begin

SpeedGL.MediaPlayer1.FileName:='Sound&bsol;Race.mp3';

SpeedGL.MediaPlayer1.Open;

SpeedGL.MediaPlayer1.Play;

end;

if (PressedKey[27]=true)and(CountTickTimer>100) then

begin

Selected_Menu_item:='';

SpeedGL.MediaPlayer1.Stop;

SpeedGL.MediaPlayer1.Close;

SpeedGL.MediaPlayer1.FileName:='';

Menu_item:=2;

CountTickTimer:=0;

Speed:=0.0;

sound:=false;

CountFuel:=8;

CountKM:=0;

end;

//торможение

if PressedKey[40]=true then

begin

Speed:=Speed+0.00002;

GasDeley:=1;

end;

if (CountFuel>0)and(CountKM<20) then if PressedKey[38]=true then Speed:=Speed-0.000005;//разгон

if (PressedKey[39]=true)and(Speed<-0.00001) then X_KordCar:=X_KordCar+0.00005-Speed/5;//поворотвправосучётомскорости

if (PressedKey[37]=true)and(Speed<-0.00001) then X_KordCar:=X_KordCar-0.00005+Speed/5;//поворотвлевосучётомскорости

if (PressedKey[40]=False)and(PressedKey[38]=False) then begin Speed:=Speed+0.000003; GasDeley:=1; end;//торможениеинерцией