unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
jpeg, ExtCtrls, ComCtrls, StdCtrls, MPlayer;
type
TForm1 =
class(TForm)
Timer1: TTimer;
ImLevel1: TImage;
ProgressBar1: TProgressBar;
ImTitelbild: TImage;
BtSpielbeginnen: TButton;
BtSpielregeln: TButton;
ImLevel: TImage;
BtLeicht: TButton;
BtMittel: TButton;
BtSchwer: TButton;
BtZurueck: TButton;
BtAbbrechen: TButton;
TitelMusik: TMediaPlayer;
ImFeer1: TImage;
ImFeer3: TImage;
ImFeer2: TImage;
ImFeer5: TImage;
Imfeer6: TImage;
ImFeer7: TImage;
ImFeer8: TImage;
ImFeer4: TImage;
ImHexer1: TImage;
Level1: TMediaPlayer;
ImLevel2: TImage;
ImHexeg2: TImage;
ImHexeg1: TImage;
Level2: TMediaPlayer;
ImFeeg1: TImage;
ImFeeg3: TImage;
ImFeeg4: TImage;
ImFeeg2: TImage;
ImFeeg5: TImage;
ImFeeg6: TImage;
Timer2: TTimer;
ImLevel3: TImage;
ImFeeb1: TImage;
ImFeeb2: TImage;
ImFeeb4: TImage;
ImFeeb3: TImage;
ImHexeb1: TImage;
ImHexeb2: TImage;
ImHexeb8: TImage;
ImHexeb4: TImage;
ImHexeb5: TImage;
ImHexeb7: TImage;
ImHexeb3: TImage;
ImHexeb6: TImage;
Timer3: TTimer;
Level3: TMediaPlayer;
Label1: TLabel;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure BtSpielbeginnenClick(Sender: TObject);
procedure BtZurueckClick(Sender: TObject);
procedure BtLeichtClick(Sender: TObject);
procedure ImFeer1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure ImHexer1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure BtAbbrechenClick(Sender: TObject);
procedure BtMittelClick(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
procedure ImFeeg1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure ImHexeg1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure BtSchwerClick(Sender: TObject);
procedure Timer3Timer(Sender: TObject);
procedure ImFeeb2MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure ImHexeb1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private-Deklarationen }
procedure CreateNewDirection;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
vx, vy: integer;
xv, yv: integer;
Counter_zSec: Integer = 0;
Counter_Sec: Integer = 0;
highscore : Integer = 0;
const
SEC = 45;
implementation
{$R *.DFM}
procedure TForm1.Timer1Timer(Sender: TObject);
begin
begin
ImFeer1.visible:=true;
ImFeer1.Left := ImFeer1.Left + vx;
ImFeer1.Top := ImFeer1.Top + vy;
ImFeer2.visible:=true;
ImFeer2.Left := ImFeer2.Left + vx;
ImFeer2.Top := ImFeer2.Top + vy;
ImFeer3.visible:=true;
ImFeer3.Left := ImFeer3.Left + vx;
ImFeer3.Top := ImFeer3.Top + vy;
ImFeer4.visible:=true;
ImFeer4.Left := ImFeer4.Left + vx;
ImFeer4.Top := ImFeer4.Top + vy;
ImFeer5.visible:=true;
ImFeer5.Left := ImFeer5.Left + vx;
ImFeer5.Top := ImFeer5.Top + vy;
ImFeer6.visible:=true;
ImFeer6.Left := ImFeer6.Left + vx;
ImFeer6.Top := ImFeer6.Top + vy;
ImFeer7.visible:=true;
ImFeer7.Left := ImFeer7.Left + vx;
ImFeer7.Top := ImFeer7.Top + vy;
ImFeer8.visible:=true;
ImFeer8.Left := ImFeer8.Left + vx;
ImFeer8.Top := ImFeer8.Top + vy;
ImHexer1.visible:=true;
ImHexer1.Left := ImHexer1.Left + xv;
ImHexer1.Top := ImHexer1.Top + yv;
inc(Counter_zSec);
if Counter_zSec
mod 5 = 0
then
begin
inc(Counter_Sec);
ProgressBar1.Position := Counter_Sec;
ProgressBar1.Perform($0409, 0, clred);
end;
if (ImFeer1.Left > ImLevel1.Width - ImFeer1.Width - 1)
or (ImFeer1.Left < 1)
then
vx := vx * -1;
if (ImFeer1.Top > ImLevel1.Height - ImFeer1.Height - 1)
or (ImFeer1.Top < 1)
then
vy := vy * -1;
if (ImFeer2.Left > ImLevel1.Width - ImFeer2.Width - 1)
or (ImFeer2.Left < 1)
then
vx := vx * -1;
if (ImFeer2.Top > ImLevel1.Height - ImFeer2.Height - 1)
or (ImFeer2.Top < 1)
then
vy := vy * -1;
if (ImFeer3.Left > ImLevel1.Width - ImFeer3.Width - 1)
or (ImFeer3.Left < 1)
then
vx := vx * -1;
if (ImFeer3.Top > ImLevel1.Height - ImFeer3.Height - 1)
or (ImFeer3.Top < 1)
then
vy := vy * -1;
if (ImFeer4.Left > ImLevel1.Width - ImFeer4.Width - 1)
or (ImFeer4.Left < 1)
then
vx := vx * -1;
if (ImFeer4.Top > ImLevel1.Height - ImFeer4.Height - 1)
or (ImFeer4.Top < 1)
then
vy := vy * -1;
if (ImFeer5.Left > ImLevel1.Width - ImFeer5.Width - 1)
or (ImFeer5.Left < 1)
then
vx := vx * -1;
if (ImFeer5.Top > ImLevel1.Height - ImFeer5.Height - 1)
or (ImFeer5.Top < 1)
then
vy := vy * -1;
if (ImFeer6.Left > ImLevel1.Width - ImFeer6.Width - 1)
or (ImFeer6.Left < 1)
then
vx := vx * -1;
if (ImFeer6.Top > ImLevel1.Height - ImFeer6.Height - 1)
or (ImFeer6.Top < 1)
then
vy := vy * -1;
if (ImFeer7.Left > ImLevel1.Width - ImFeer7.Width - 1)
or (ImFeer7.Left < 1)
then
vx := vx * -1;
if (ImFeer7.Top > ImLevel1.Height - ImFeer7.Height - 1)
or (ImFeer7.Top < 1)
then
vy := vy * -1;
if (ImFeer8.Left > ImLevel1.Width - ImFeer8.Width - 1)
or (ImFeer8.Left < 1)
then
vx := vx * -1;
if (ImFeer8.Top > ImLevel1.Height - ImFeer8.Height - 1)
or (ImFeer8.Top < 1)
then
vy := vy * -1;
if (ImHexer1.Left > ImLevel1.Width - ImHexer1.Width - 1)
or (ImHexer1.Left < 1)
then
xv := xv * -2;
if (ImHexer1.Top > ImLevel1.Height - ImHexer1.Height - 1)
or (ImHexer1.Top < 1)
then
yv := yv * -2;
if Counter_Sec = 45
then
begin
Form1.Caption:=('
Leichtes Level ist vorbei');
ImFeer1.Visible := false;
ImFeer2.Visible:=false;
ImFeer3.Visible:=false;
ImFeer4.Visible := false;
ImFeer5.Visible:=false;
ImFeer6.Visible:=false;
ImFeer7.Visible:=false;
ImFeer8.Visible:=false;
ImHexer1.visible:=false;
Timer1.Enabled := false;
end;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
TitelMusik.Start;
TitelMusik.Play;
Randomize;
DoubleBuffered := true;
ProgressBar1.Max := 60;
CreateNewDirection;
end;
procedure TForm1.CreateNewDirection;
begin
vx := -10 + Random(50);
vy := -10 + Random(50);
xv:= -1 + Random (10);
yv:= -1 + Random (10);
end;
procedure TForm1.ImHexer1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ImHexer1.visible:=false;
CreateNewDirection;
ImHexer1.Left := Random(ImLevel1.Width-ImHexer1.Width);
ImHexer1.Top := random(ImLevel1.Height - ImHexer1.Height);
highscore := highscore - 5;
Label1.Caption := '
Highscore: ' + IntToStr(highscore);
end;
procedure TForm1.BtSpielbeginnenClick(Sender: TObject);
begin
TitelMusik.Play;
TitelMusik.Start;
Level1.Stop;
Level1.Pause;
ImTitelbild.visible:=false;
ImLevel.visible:=true;
BtLeicht.visible:=true;
BtMittel.visible:=true;
BtSchwer.visible:=true;
BtZurueck.visible:=true;
Form1.Caption:='
Leveleditor';
BtSpielbeginnen.visible:=false;
BtSpielregeln.visible:=false;
end;
procedure TForm1.BtZurueckClick(Sender: TObject);
begin
TitelMusik.Play;
TitelMusik.Start;
Level1.Stop;
Level1.Pause;
ImTitelbild.visible:=true;
ImLevel.visible:=false;
BtLeicht.visible:=false;
BtMittel.visible:=false;
BtSchwer.visible:=false;
BtZurueck.visible:=false;
BtSpielbeginnen.visible:=true;
BtSpielregeln.visible:=true;
end;
procedure TForm1.BtLeichtClick(Sender: TObject);
begin
Titelmusik.Stop;
Titelmusik.Pause;
Level1.Start;
Level1.Play;
ImLevel.visible:=false;
BtLeicht.visible:=false;
BtMittel.visible:=false;
BtSchwer.visible:=false;
BtZurueck.visible:=false;
//Menü 1 aus
ImLevel1.visible:=true;
Timer1.Enabled:=true;
ProgressBar1.visible:=true;
Form1.Caption:='
Level Leicht';
Label1.visible:=true;
BtAbbrechen.visible:=true;
//Level 1 gestartet
end;
procedure TForm1.ImFeer1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
begin
ImFeer1.Visible := false;
ImFeer2.Visible:=false;
ImFeer3.Visible:=false;
ImFeer4.Visible := false;
ImFeer5.Visible:=false;
ImFeer6.Visible:=false;
ImFeer7.Visible:=false;
ImFeer8.Visible:=false;
CreateNewDirection;
ImFeer1.Left := Random(ImLevel1.Width-ImFeer1.Width);
ImFeer1.Top := random(ImLevel1.Height - ImFeer1.Height);
ImFeer2.Left := Random(ImLevel1.Width-ImFeer2.Width);
ImFeer2.Top := random(ImLevel1.Height - ImFeer2.Height);
ImFeer3.Left := Random(ImLevel1.Width-ImFeer3.Width);
ImFeer3.Top := random(ImLevel1.Height - ImFeer3.Height);
ImFeer4.Left := Random(ImLevel1.Width-ImFeer4.Width);
ImFeer4.Top := random(ImLevel1.Height - ImFeer4.Height);
ImFeer5.Left := Random(ImLevel1.Width-ImFeer5.Width);
ImFeer5.Top := random(ImLevel1.Height - ImFeer5.Height);
ImFeer6.Left := Random(ImLevel1.Width-ImFeer6.Width);
ImFeer6.Top := random(ImLevel1.Height - ImFeer6.Height);
ImFeer7.Left := Random(ImLevel1.Width-ImFeer7.Width);
ImFeer7.Top := random(ImLevel1.Height - ImFeer7.Height);
ImFeer8.Left := Random(ImLevel1.Width-ImFeer8.Width);
ImFeer8.Top := random(ImLevel1.Height - ImFeer8.Height);
highscore := highscore + 20;
Label1.Caption := '
Highscore: ' + IntToStr(highscore);
end;
end;
procedure TForm1.BtAbbrechenClick(Sender: TObject);
begin
TitelMusik.Play;
TitelMusik.Start;
Level1.Pause;
Level1.Stop;
Level2.Pause;
Level2.Stop;
Level3.Pause;
Level3.Stop;
ImLevel3.visible:=false;
ImLevel2.visible:=false;
ImLevel.visible:=true;
BtLeicht.visible:=true;
BtMittel.visible:=true;
BtSchwer.visible:=true;
BtZurueck.visible:=true;
//Menü 1 ein
ImLevel1.visible:=false;
Timer1.Enabled:=false;
ProgressBar1.visible:=false;
Form1.Caption:='
Leveleditor';
Label1.visible:=false;
BtAbbrechen.visible:=false;
ImFeer1.Visible := false;
ImFeer2.Visible:=false;
ImFeer3.Visible:=false;
ImFeer4.Visible := false;
ImFeer5.Visible:=false;
ImFeer6.Visible:=false;
ImFeer7.Visible:=false;
ImFeer8.Visible:=false;
ImHexer1.visible:=false;
ImFeeg1.Visible := false;
ImFeeg2.visible:=false;
ImFeeg3.visible:=false;
ImFeeg4.Visible := false;
ImFeeg5.Visible:=false;
ImFeeg6.Visible:=false;
ImHexeg1.visible:=false;
ImHexeg2.visible:=false;
Timer2.Enabled := false;
ImFeeb1.Visible := false;
(*blaue Feen aus*)
ImFeeb2.Visible:=false;
ImFeeb3.Visible:=false;
ImFeeb4.Visible:=false;
ImHexeb1.visible:=false;
(*blaue Hexen aus*)
ImHexeb2.visible:=false;
ImHexeb3.visible:=false;
ImHexeb4.visible:=false;
ImHexeb5.visible:=false;
ImHexeb6.visible:=false;
ImHexeb7.visible:=false;
ImHexeb8.visible:=false;
Timer3.Enabled :=false;
end;
procedure TForm1.BtMittelClick(Sender: TObject);
begin
TitelMusik.Stop;
TitelMusik.Pause;
Level2.Play;
Level2.Start;
ImTitelbild.visible:=false;
ImLevel2.visible:=true;
BtLeicht.visible:=false;
BtMittel.visible:=false;
BtSchwer.visible:=false;
BtZurueck.visible:=false;
BtAbbrechen.visible:=true;
ProgressBar1.visible:=true;
Label1.visible:=true;
Form1.Caption:='
Sie spielen den mittle schwere Version';
ImFeeg1.Visible := true;
ImFeeg2.Visible:=true;
ImFeeg3.Visible:=true;
ImFeeg4.Visible := true;
ImFeeg5.Visible:=true;
ImFeeg6.Visible:=true;
ImHexeg1.visible:=true;
ImHexeg2.visible:=true;
Timer2.enabled:=true;
end;
procedure TForm1.Timer2Timer(Sender: TObject);
begin
begin
ImFeeg1.visible:=true;
ImFeeg1.Left := ImFeeg1.Left + vx;
ImFeeg1.Top := ImFeeg1.Top + vy;
ImFeeg2.visible:=true;
ImFeeg2.Left := ImFeeg2.Left + vx;
ImFeeg2.Top := ImFeeg2.Top + vy;
ImFeeg3.visible:=true;
ImFeeg3.Left := ImFeeg3.Left + vx;
ImFeeg3.Top := ImFeeg3.Top + vy;
ImFeeg4.visible:=true;
ImFeeg4.Left := ImFeeg4.Left + vx;
ImFeeg4.Top := ImFeeg4.Top + vy;
ImFeeg5.visible:=true;
ImFeeg5.Left := ImFeeg5.Left + vx;
ImFeeg5.Top := ImFeeg5.Top + vy;
ImFeeg6.visible:=true;
ImFeeg6.Left := ImFeeg6.Left + vx;
ImFeeg6.Top := ImFeeg6.Top + vy;
ImHexeg1.visible:=true;
ImHexeg1.Left := ImHexeg1.Left + xv;
ImHexeg1.Top := ImHexeg1.Top + yv;
ImHexeg2.visible:=true;
ImHexeg2.Left := ImHexeg2.Left + xv;
ImHexeg2.Top := ImHexeg2.Top + yv;
inc(Counter_zSec);
if Counter_zSec
mod 5 = 0
then
begin
inc(Counter_Sec);
ProgressBar1.Position := Counter_Sec;
ProgressBar1.Perform($0409, 0, clgreen);
end;
if (ImFeeg1.Left > ImLevel2.Width - ImFeeg1.Width - 1)
or (ImFeeg1.Left < 1)
then
vx := vx * -1;
if (ImFeeg1.Top > ImLevel2.Height - ImFeeg1.Height - 1)
or (ImFeeg1.Top < 1)
then
vy := vy * -1;
if (ImFeeg2.Left > ImLevel2.Width - ImFeeg2.Width - 1)
or (ImFeeg2.Left < 1)
then
vx := vx * -1;
if (ImFeeg2.Top > ImLevel2.Height - ImFeeg2.Height - 1)
or (ImFeeg2.Top < 1)
then
vy := vy * -1;
if (ImFeeg3.Left > ImLevel2.Width - ImFeeg3.Width - 1)
or (ImFeeg3.Left < 1)
then
vx := vx * -1;
if (ImFeeg3.Top > ImLevel2.Height - ImFeeg3.Height - 1)
or (ImFeeg3.Top < 1)
then
vy := vy * -1;
if (ImFeeg4.Left > ImLevel2.Width - ImFeeg4.Width - 1)
or (ImFeeg4.Left < 1)
then
vx := vx * -1;
if (ImFeeg4.Top > ImLevel2.Height - ImFeeg4.Height - 1)
or (ImFeeg4.Top < 1)
then
vy := vy * -1;
if (ImFeeg5.Left > ImLevel2.Width - ImFeeg5.Width - 1)
or (ImFeeg5.Left < 1)
then
vx := vx * -1;
if (ImFeeg5.Top > ImLevel2.Height - ImFeeg5.Height - 1)
or (ImFeeg5.Top < 1)
then
vy := vy * -1;
if (ImFeeg6.Left > ImLevel2.Width - ImFeeg6.Width - 1)
or (ImFeeg6.Left < 1)
then
vx := vx * -1;
if (ImFeeg6.Top > ImLevel2.Height - ImFeeg6.Height - 1)
or (ImFeeg6.Top < 1)
then
vy := vy * -1;
if (ImHexeg1.Left > ImLevel2.Width - ImHexeg1.Width - 1)
or (ImHexeg1.Left < 1)
then
xv := xv * -1;
if (ImHexeg1.Top > ImLevel2.Height - ImHexeg1.Height - 1)
or (ImHexeg1.Top < 1)
then
yv := yv * -1;
if (ImHexeg2.Left > ImLevel2.Width - ImHexeg2.Width - 1)
or (ImHexeg2.Left < 1)
then
xv := xv * -1;
if (ImHexeg2.Top > ImLevel2.Height - ImHexeg2.Height - 1)
or (ImHexeg2.Top < 1)
then
yv := yv * -1;
if Counter_Sec = 45
then
begin
Form1.Caption:=('
Das mittel schwere Level ist vorbei');
ImFeeg1.Visible := false;
ImFeeg2.Visible:=false;
ImFeeg3.Visible:=false;
ImFeeg4.Visible := false;
ImFeeg5.Visible:=false;
ImFeeg6.Visible:=false;
ImHexeg1.visible:=false;
ImHexeg2.visible:=false;
Timer2.Enabled := false;
end;
end;
end;
procedure TForm1.ImHexeg1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
begin
ImHexeg1.Visible := false;
ImHexeg2.Visible:=false;
ImHexeg1.Left := Random(ImLevel2.Width-ImHexeg1.Width);
ImHexeg1.Top := random(ImLevel2.Height - ImHexeg1.Height);
ImHexeg2.Left := Random(ImLevel2.Width-ImHexeg2.Width);
ImHexeg2.Top := random(ImLevel2.Height - ImHexeg2.Height);
highscore := highscore - 10;
Label1.Caption := '
Highscore: ' + IntToStr(highscore);
Label1.Color:=clgreen;
end;
end;
procedure TForm1.ImFeeg1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
begin
ImFeeg1.Visible := false;
ImFeeg2.visible:=false;
ImFeeg3.visible:=false;
ImFeeg4.Visible := false;
ImFeeg5.Visible:=false;
ImFeeg6.Visible:=false;
CreateNewDirection;
ImFeeg1.Left := Random(ImLevel2.Width-ImFeeg1.Width);
ImFeeg1.Top := random(ImLevel2.Height - ImFeeg1.Height);
ImFeeg2.Left := Random(ImLevel2.Width-ImFeeg2.Width);
ImFeeg2.Top := random(ImLevel2.Height - ImFeeg2.Height);
ImFeeg3.Left := Random(ImLevel2.Width-ImFeeg3.Width);
ImFeeg3.Top := random(ImLevel2.Height - ImFeeg3.Height);
ImFeeg4.Left := Random(ImLevel2.Width-ImFeeg4.Width);
ImFeeg4.Top := random(ImLevel2.Height - ImFeeg4.Height);
ImFeeg5.Left := Random(ImLevel2.Width-ImFeeg5.Width);
ImFeeg5.Top := random(ImLevel2.Height - ImFeeg5.Height);
ImFeeg6.Left := Random(ImLevel2.Width-ImFeeg6.Width);
ImFeeg6.Top := random(ImLevel2.Height - ImFeeg6.Height);
highscore := highscore + 20;
Label1.Caption := '
Highscore: ' + IntToStr(highscore);
Label1.Color:=clgreen;
end;
end;
procedure TForm1.BtSchwerClick(Sender: TObject);
begin
TitelMusik.Stop;
TitelMusik.Pause;
Level3.Play;
Level3.Start;
ImTitelbild.visible:=false;
ImLevel3.visible:=true;
BtLeicht.visible:=false;
BtMittel.visible:=false;
BtSchwer.visible:=false;
BtZurueck.visible:=false;
BtAbbrechen.visible:=true;
ProgressBar1.visible:=true;
Label1.visible:=true;
Form1.Caption:='
Sie spielen die schwere Version';
ImFeeb1.Visible :=true;
ImFeeb2.Visible:=true;
ImFeeb3.Visible:=true;
ImFeeb4.Visible:=true;
ImHexeb1.visible:=true;
ImHexeb2.visible:=true;
ImHexeb3.visible:=true;
ImHexeb4.visible:=true;
ImHexeb5.visible:=true;
ImHexeb6.visible:=true;
ImHexeb7.visible:=true;
ImHexeb8.visible:=true;
Timer3.enabled:=true;
end;
procedure TForm1.Timer3Timer(Sender: TObject);
begin
ImHexeb1.visible:=true;
ImHexeb1.Left := ImHexeb1.Left + xv;
ImHexeb1.Top := ImHexeb1.Top + yv;
(*erste blaue Hexe*)
ImHexeb2.visible:=true;
ImHexeb2.Left := ImHexeb2.Left + xv;
ImHexeb2.Top := ImHexeb2.Top + yv;
(*Zweite blaue Hexe*)
ImHexeb3.visible:=true;
ImHexeb3.Left := ImHexeb3.Left + xv;
ImHexeb3.Top := ImHexeb3.Top + yv;
(*dritte blaue Hexe*)
ImHexeb4.visible:=true;
ImHexeb4.Left := ImHexeb4.Left + xv;
ImHexeb4.Top := ImHexeb4.Top + yv;
(*erste blaue Hexe*)
ImHexeb5.visible:=true;
ImHexeb5.Left := ImHexeb5.Left + xv;
ImHexeb5.Top := ImHexeb5.Top + yv;
(*Zweite blaue Hexe*)
ImHexeb6.visible:=true;
ImHexeb6.Left := ImHexeb6.Left + xv;
ImHexeb6.Top := ImHexeb6.Top + yv;
(*dritte blaue Hexe*)
ImHexeb7.visible:=true;
ImHexeb7.Left := ImHexeb7.Left + xv;
ImHexeb7.Top := ImHexeb7.Top + yv;
(*Zweite blaue Hexe*)
ImHexeb8.visible:=true;
ImHexeb8.Left := ImHexeb3.Left + xv;
ImHexeb8.Top := ImHexeb3.Top + yv;
(*dritte blaue Hexe*)
ImFeeb1.visible:=true;
ImFeeb1.Left := ImFeeb1.Left + vx;
ImFeeb1.Top := ImFeeb1.Top + vy;
(*erste blaue Fee*)
ImFeeb2.visible:=true;
ImFeeb2.Left := ImFeeb2.Left + vx;
ImFeeb2.Top := ImFeeb2.Top + vy;
(*Zweite blaue Fee*)
ImFeeb3.visible:=true;
ImFeeb3.Left := ImFeeb3.Left + vx;
ImFeeb3.Top := ImFeeb3.Top + vy;
(*dritte blaue Fee*)
ImFeeb4.visible:=true;
ImFeeb4.Left := ImFeeb4.Left + vx;
ImFeeb4.Top := ImFeeb4.Top + vy;
inc(Counter_zSec);
if Counter_zSec
mod 5 = 0
then
begin
inc(Counter_Sec);
ProgressBar1.Position := Counter_Sec;
ProgressBar1.Perform($0409, 0, clTeal);
end;
if (ImFeeb1.Left > ImLevel3.Width - ImFeeb1.Width - 1)
or (ImFeeb1.Left < 1)
then
vx := vx * -1;
if (ImFeeb1.Top > ImLevel3.Height - ImFeeb1.Height - 1)
or (ImFeeb1.Top < 1)
then
vy := vy * -1;
(*erste blaue Fee*)
if (ImFeeb2.Left > ImLevel3.Width - ImFeeb2.Width - 1)
or (ImFeeb2.Left < 1)
then
vx := vx * -1;
if (ImFeeb2.Top > ImLevel3.Height - ImFeeb2.Height - 1)
or (ImFeeb2.Top < 1)
then
vy := vy * -1;
(*zweite blaue Fee*)
if (ImFeeb3.Left > ImLevel3.Width - ImFeeb3.Width - 1)
or (ImFeeb3.Left < 1)
then
vx := vx * -1;
if (ImFeeb3.Top > ImLevel3.Height - ImFeeb3.Height - 1)
or (ImFeeb3.Top < 1)
then
vy := vy * -1;
(*dritte blaue Fee*)
if (ImFeeb4.Left > ImLevel3.Width - ImFeeb4.Width - 1)
or (ImFeeb4.Left < 1)
then
vx := vx * -1;
if (ImFeeb4.Top > ImLevel3.Height - ImFeeb4.Height - 1)
or (ImFeeb4.Top < 1)
then
vy := vy * -1;
if (ImHexeb1.Left > ImLevel3.Width - ImHexeb1.Width - 1)
or (ImHexeb1.Left < 1)
then
xv := xv * -1;
if (ImHexeb1.Top > ImLevel3.Height - ImHexeb1.Height - 1)
or (ImHexeb1.Top < 1)
then
yv := yv * -1;
if (ImHexeb2.Left > ImLevel3.Width - ImHexeb2.Width - 1)
or (ImHexeb2.Left < 1)
then
xv := xv * -1;
if (ImHexeb2.Top > ImLevel3.Height - ImHexeb2.Height - 1)
or (ImHexeb2.Top < 1)
then
yv := yv * -1;
if (ImHexeb3.Left > ImLevel3.Width - ImHexeb3.Width - 1)
or (ImHexeb3.Left < 1)
then
xv := xv * -1;
if (ImHexeb3.Top > ImLevel3.Height - ImHexeb3.Height - 1)
or (ImHexeb3.Top < 1)
then
yv := yv * -1;
if (ImHexeb4.Left > ImLevel3.Width - ImHexeb4.Width - 1)
or (ImHexeb4.Left < 1)
then
xv := xv * -1;
if (ImHexeb4.Top > ImLevel3.Height - ImHexeb4.Height - 1)
or (ImHexeb4.Top < 1)
then
yv := yv * -1;
if (ImHexeb5.Left > ImLevel3.Width - ImHexeb5.Width - 1)
or (ImHexeb5.Left < 1)
then
xv := xv * -1;
if (ImHexeb5.Top > ImLevel3.Height - ImHexeb5.Height - 1)
or (ImHexeb5.Top < 1)
then
yv := yv * -1;
if (ImHexeb6.Left > ImLevel3.Width - ImHexeb6.Width - 1)
or (ImHexeb6.Left < 1)
then
xv := xv * -1;
if (ImHexeb6.Top > ImLevel3.Height - ImHexeb6.Height - 1)
or (ImHexeb6.Top < 1)
then
yv := yv * -1;
if (ImHexeb7.Left > ImLevel3.Width - ImHexeb7.Width - 1)
or (ImHexeb7.Left < 1)
then
xv := xv * -1;
if (ImHexeb7.Top > ImLevel3.Height - ImHexeb7.Height - 1)
or (ImHexeb7.Top < 1)
then
yv := yv * -1;
if (ImHexeb8.Left > ImLevel3.Width - ImHexeb8.Width - 1)
or (ImHexeb8.Left < 1)
then
xv := xv * -1;
if (ImHexeb8.Top > ImLevel3.Height - ImHexeb8.Height - 1)
or (ImHexeb8.Top < 1)
then
yv := yv * -1;
if Counter_Sec = 45
then
begin
Form1.Caption:=('
Spiel ist vorbei');
ImFeeb1.Visible := false;
(*blaue Feen aus*)
ImFeeb2.Visible:=false;
ImFeeb3.Visible:=false;
ImFeeb4.Visible:=false;
ImHexeb1.visible:=false;
(*blaue Hexen aus*)
ImHexeb2.visible:=false;
ImHexeb3.visible:=false;
ImHexeb4.visible:=false;
ImHexeb5.visible:=false;
ImHexeb6.visible:=false;
ImHexeb7.visible:=false;
ImHexeb8.visible:=false;
Timer3.Enabled := false;
end;
end;
procedure TForm1.ImFeeb2MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ImFeeb1.Visible := false;
ImFeeb2.Visible:=false;
ImFeeb3.Visible:=false;
ImFeeb4.Visible:=false;
ImFeeb1.Left := Random(ImLevel3.Width-ImFeeb1.Width);
ImFeeb1.Top := random(ImLevel3.Height - ImFeeb1.Height);
ImFeeb2.Left := Random(ImLevel3.Width-ImFeeb2.Width);
ImFeeb2.Top := random(ImLevel3.Height - ImFeeb2.Height);
ImFeeb3.Left := Random(ImLevel3.Width-ImFeeb3.Width);
ImFeeb3.Top := random(ImLevel3.Height - ImFeeb3.Height);
ImFeeb4.Left := Random(ImLevel3.Width-ImFeeb4.Width);
ImFeeb4.Top := random(ImLevel3.Height - ImFeeb4.Height);
highscore := highscore + 20;
Label1.Caption := '
Highscore: ' + IntToStr(highscore);
end;
procedure TForm1.ImHexeb1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
begin
ImHexeb1.Visible := false;
ImHexeb2.Visible:=false;
ImHexeb3.Visible:=false;
ImHexeb4.visible:=false;
ImHexeb5.visible:=false;
ImHexeb6.visible:=false;
ImHexeb7.visible:=false;
ImHexeb8.visible:=false;
ImHexeb1.Left := Random(ImLevel3.Width-ImHexeb1.Width);
ImHexeb1.Top := random(ImLevel3.Height - ImHexeb1.Height);
ImHexeb2.Left := Random(ImLevel3.Width-ImHexeb2.Width);
ImHexeb2.Top := random(ImLevel3.Height - ImHexeb2.Height);
ImHexeb3.Left := Random(ImLevel3.Width-ImHexeb3.Width);
ImHexeb3.Top := random(ImLevel3.Height - ImHexeb3.Height);
ImHexeb4.Left := Random(ImLevel3.Width-ImHexeb4.Width);
ImHexeb4.Top := random(ImLevel3.Height - ImHexeb4.Height);
ImHexeb5.Left := Random(ImLevel3.Width-ImHexeb5.Width);
ImHexeb5.Top := random(ImLevel3.Height - ImHexeb5.Height);
ImHexeb6.Left := Random(ImLevel3.Width-ImHexeb6.Width);
ImHexeb6.Top := random(ImLevel3.Height - ImHexeb6.Height);
ImHexeb7.Left := Random(ImLevel3.Width-ImHexeb7.Width);
ImHexeb7.Top := random(ImLevel3.Height - ImHexeb7.Height);
ImHexeb8.Left := Random(ImLevel3.Width-ImHexeb8.Width);
ImHexeb8.Top := random(ImLevel3.Height - ImHexeb8.Height);
highscore := highscore - 15;
Label1.Caption := '
Highscore: ' + IntToStr(highscore);
end;
end;
end.