|
|
发表于 2005-11-29 14:02:00
|
显示全部楼层
Re:“对对碰”小游戏进入最后测试!
在Timer的Onprocess 事件中加入控制:
procedure TMainForm.TimerProcess(Sender: TObject);
begin
if not Application.Active then
begin
if not l_Pause and (ls_Time > 0) then
begin
if l_WaveOn and (FSound[10] <> nil) then FSOUND_PlaySound(FSOUND_FREE, FSound[10]);
Timer1.Enabled := not Timer1.Enabled;
l_PLaying := not l_Playing;
l_Pause := not l_Pause;
if l_MusicOn then FMUSIC_SetPaused(FMusic, l_Pause);
end;
end;
end;
然后把timer的OnTimer事件改成:
procedure TMainForm.TimerTimer(Sender: TObject);
begin
// 画
Device.Render(0, True);
Timer.Process(1); // <<——在这儿添加
// 上演
Device.Flip();
//若游戏结束,检查是记入排行榜
if l_GameOver then
begin
if (ls_Chengji > ls_Players[4].Score) and (not l_Inputed) then
begin
l_Playing := False;
if l_WaveOn and (FSound[13] <> nil) then FSOUND_PlaySound(FSOUND_FREE, FSound[13]);
Form2.ShowModal;
end
else if (l_WaveOn) and (Timer1.Enabled) then
begin
if ls_Time = 0 then
begin
if l_MusicOn then
begin
FMUSIC_StopSong(FMusic);
end;
end;
if (FSound[8] <> nil) then FSOUND_PlaySound(FSOUND_FREE, FSound[8]);
end;
Timer1.Enabled := false;
end;
end;
|
|