Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- implementation
- {$R *.dfm}
- uses UnitAbout, UnitError, UnitExit, UnitInstruction_6_1;
- const EXIT_VALUE = 1;
- procedure TFormWalkingMan.ButtonAboutClick(Sender: TObject);
- begin
- UnitAbout.FormAbout.ShowModal();
- end;
- procedure TFormWalkingMan.ButtonTaskClick(Sender: TObject);
- begin
- UnitInstruction_6_1.FormInstruction.ShowModal;
- end;
- procedure TFormWalkingMan.FormCloseQuery(Sender: TObject;
- var CanClose: Boolean);
- begin
- CanClose := UnitExit.FormExit.ShowModal = EXIT_VALUE;
- end;
- procedure TFormWalkingMan.FormCreate(Sender: TObject);
- begin
- Timer.Enabled := false;
- end;
- procedure TFormWalkingMan.FormKeyPress(Sender: TObject; var Key: Char);
- begin
- if Key = #13 then
- begin
- Man.Left := 8;
- BodyDefault.Visible := false;
- GIFImageDefaultAnimate := True;
- try
- Man.Picture.LoadFromFile('Man.gif');
- Man.Transparent := true;
- Man.Visible := true;
- Timer.Enabled := true;
- except
- UnitError.FormError.LabelError.Caption := 'Не найден файл с необходимым изображением!';
- UnitError.FormError.ShowModal;
- UnitError.FormError.LabelError.Caption := '';
- end;
- end;
- end;
- function CheckFormEnd(CurrPos, FormWidth: Integer; var Man: TImage): Boolean;
- begin
- if (CurrPos > FormWidth) then
- begin
- Man.Visible := false;
- CheckFormEnd := false;
- end
- else
- CheckFormEnd := true;
- end;
- procedure TFormWalkingMan.TimerTimer(Sender: TObject);
- begin
- Man.Left := Man.Left + 5;
- Timer.Enabled := CheckFormEnd(Man.Left, Width, Man);
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement