unit CapMan;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls;
type
TForm1 =
class(TForm)
Label1: TLabel;
Label2: TLabel;
BitBtn1: TBitBtn;
Timer1: TTimer;
procedure FormKeyPress(Sender: TObject;
var Key: Char);
procedure FormCreate(Sender: TObject);
procedure Waende;
procedure Timer1Timer(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1 ;
x : integer = 200;
//Alle Variablen global da: -Kopieren nicht notig
y : integer = 200;
// -Alle Proceduren benutzen diese
c : integer;
// Abstand -andern sich eh standig
r: integer = 20;
// Radius
t: integer = 40;
// Verzogerung beim Offnen/Schliesen
s: integer = 20;
// Schritt Lange
fm : integer = clblack;
// Maul Farbe
fh : integer = clblack;
// Hintergrund Farbe
x1: integer = 40 ; x11: integer = 40 ; x21: integer = 240 ;
//x-werte für Punkte
x2: integer = 80 ; x12: integer = 40 ; x22: integer = 280 ;
x3: integer = 120 ; x13: integer = 40 ; x23: integer = 320 ;
x4: integer = 160 ; x14: integer = 40 ; x24: integer = 360 ;
x5: integer = 200 ; x15: integer = 40 ; x25: integer = 360 ;
x6: integer = 240 ; x16: integer = 40 ; x26: integer = 360 ;
x7: integer = 280 ; x17: integer = 80 ; x27: integer = 360 ;
x8: integer = 320 ; x18: integer = 120 ; x28: integer = 360 ;
x9: integer = 360 ; x19: integer = 160 ; x29: integer = 360 ;
x10: integer = 40 ; x20: integer = 200 ; x30: integer = 360 ;
w :
array [1..100, 1..2]
of integer;
//y-werte für punkte
rp: integer = 10;
//radius punkte
mx: integer = 300;
//Monster x-wert
my:integer = 300;
//Monster y-wert
implementation
{$R *.dfm}
//******************************************************************************
//********************************(PROGRAMM)************************************
//******************************************************************************
procedure TForm1.Waende;
begin
canvas.Brush.color:=clgreen;
canvas.pen.Color:=clgreen;
canvas.rectangle(0,0,20,form1.height-20);
// R
canvas.Rectangle(0,0,form1.Width,20);
// A
canvas.Rectangle(form1.Width-40,0,form1.Width,form1.Height);
// N
canvas.Rectangle(0,form1.Height-60,form1.Width,form1.Height);
// D
w[1,2]:=40; w[11,2]:=120; w[21,2]:=320;
// y-werte für Punkte
w[2,2]:=40; w[12,2]:=160; w[22,2]:=320;
w[3,2]:=40; w[13,2]:=200; w[23,2]:=320;
w[4,2]:=40; w[14,2]:=240; w[24,2]:=320;
w[5,2]:=40; w[15,2]:=280; w[25,2]:=80;
w[6,2]:=40; w[16,2]:=320; w[26,2]:=120;
w[7,2]:=40; w[17,2]:=320; w[27,2]:=160;
w[8,2]:=40; w[18,2]:=320; w[28,2]:=200;
w[9,2]:=40; w[19,2]:=320; w[29,2]:=240;
w[10,2]:=80; w[20,2]:=320; w[30,2]:=280;
canvas.Pen.Color:=clyellow;
canvas.Brush.Color:=clyellow;
canvas.Ellipse(x1-rp,w[1,2]-rp,x1+rp,w[1,2]+rp);
canvas.Ellipse(x2-rp,w[2,2]-rp,x2+rp,w[2,2]+rp);
canvas.Ellipse(x3-rp,w[3,2]-rp,x3+rp,w[3,2]+rp);
canvas.Ellipse(x4-rp,w[4,2]-rp,x4+rp,w[4,2]+rp);
canvas.Ellipse(x5-rp,w[5,2]-rp,x5+rp,w[5,2]+rp);
canvas.Ellipse(x6-rp,w[6,2]-rp,x6+rp,w[6,2]+rp);
canvas.Ellipse(x7-rp,w[7,2]-rp,x7+rp,w[7,2]+rp);
canvas.Ellipse(x8-rp,w[8,2]-rp,x8+rp,w[8,2]+rp);
canvas.Ellipse(x9-rp,w[9,2]-rp,x9+rp,w[9,2]+rp);
canvas.Ellipse(x10-rp,w[10,2]-rp,x10+rp,w[10,2]+rp);
canvas.Ellipse(x11-rp,w[11,2]-rp,x11+rp,w[11,2]+rp);
canvas.Ellipse(x12-rp,w[12,2]-rp,x12+rp,w[12,2]+rp);
canvas.Ellipse(x13-rp,w[13,2]-rp,x13+rp,w[13,2]+rp);
canvas.Ellipse(x14-rp,w[14,2]-rp,x14+rp,w[14,2]+rp);
canvas.Ellipse(x15-rp,w[15,2]-rp,x15+rp,w[15,2]+rp);
canvas.Ellipse(x16-rp,w[16,2]-rp,x16+rp,w[16,2]+rp);
canvas.Ellipse(x17-rp,w[17,2]-rp,x17+rp,w[17,2]+rp);
canvas.Ellipse(x18-rp,w[18,2]-rp,x18+rp,w[18,2]+rp);
canvas.Ellipse(x19-rp,w[19,2]-rp,x19+rp,w[19,2]+rp);
canvas.Ellipse(x20-rp,w[20,2]-rp,x20+rp,w[20,2]+rp);
canvas.Ellipse(x21-rp,w[21,2]-rp,x21+rp,w[21,2]+rp);
canvas.Ellipse(x22-rp,w[22,2]-rp,x22+rp,w[22,2]+rp);
canvas.Ellipse(x23-rp,w[23,2]-rp,x23+rp,w[23,2]+rp);
canvas.Ellipse(x24-rp,w[24,2]-rp,x24+rp,w[24,2]+rp);
canvas.Ellipse(x25-rp,w[25,2]-rp,x25+rp,w[25,2]+rp);
canvas.Ellipse(x26-rp,w[26,2]-rp,x26+rp,w[26,2]+rp);
canvas.Ellipse(x27-rp,w[27,2]-rp,x27+rp,w[27,2]+rp);
canvas.Ellipse(x28-rp,w[28,2]-rp,x28+rp,w[28,2]+rp);
canvas.Ellipse(x29-rp,w[29,2]-rp,x29+rp,w[29,2]+rp);
canvas.Ellipse(x30-rp,w[30,2]-rp,x30+rp,w[30,2]+rp);
//canvas.Brush.Color:=clWhite; //Zeichnung des Monsters
//canvas.Ellipse(mx-r,my-r,mx+r,my+r); //erstmal ein Kreis
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
canvas.Brush.Color:=fh;
canvas.rectangle(0,0,Form1.Height,Form1.Width);
canvas.Pen.Color:=fh;
canvas.Brush.color:=clyellow;
canvas.Ellipse(x-r,y-r,x+r,y+r);
//canvas.Brush.Color:=clWhite; //Zeichnung des Monsters
//canvas.Ellipse(mx-r,my-r,mx+r,my+r); //erstmal ein Kreis
Waende;
end;
//********************************(NACH RECHTS)*********************************
procedure TForm1.FormKeyPress(Sender: TObject;
var Key: Char);
begin
if (x=x1)
and (y=w[1,2])
then inc(x1,form1.Width+100);
//Punkt 1
if (x=x2)
and (y=w[2,2])
then inc(x2,form1.Width+100);
//Punkt 2 //Die Punkte verschieben
if (x=x3)
and (y=w[3,2])
then inc(x3,form1.Width+100);
//Punkt 3 // sich aus dem Spielfeld
if (x=x4)
and (y=w[4,2])
then inc(x4,form1.Width+100);
//Punkt 4
if (x=x5)
and (y=w[5,2])
then inc(x5,form1.Width+100);
//Punkt 5
if (x=x6)
and (y=w[6,2])
then inc(x6,form1.Width+100);
//Punkt 6
if (x=x7)
and (y=w[7,2])
then inc(x7,form1.Width+100);
//Punkt 7
if (x=x8)
and (y=w[8,2])
then inc(x8,form1.Width+100);
//Punkt 8
if (x=x9)
and (y=w[9,2])
then inc(x9,form1.Width+100);
//Punkt 9
if (x=x10)
and (y=w[10,2])
then inc(x10,form1.Width+100);
//Punkt 10
if (x=x11)
and (y=w[11,2])
then inc(x11,form1.Width+100);
//Punkt 11
if (x=x12)
and (y=w[12,2])
then inc(x12,form1.Width+100);
//Punkt 12
if (x=x13)
and (y=w[13,2])
then inc(x13,form1.Width+100);
//Punkt 13
if (x=x14)
and (y=w[14,2])
then inc(x14,form1.Width+100);
//Punkt 14
if (x=x15)
and (y=w[15,2])
then inc(x15,form1.Width+100);
//Punkt 15
if (x=x16)
and (y=w[16,2])
then inc(x16,form1.Width+100);
//Punkt 16
if (x=x17)
and (y=w[17,2])
then inc(x17,form1.Width+100);
//Punkt 17
if (x=x18)
and (y=w[18,2])
then inc(x18,form1.Width+100);
//Punkt 18
if (x=x19)
and (y=w[19,2])
then inc(x19,form1.Width+100);
//Punkt 19
if (x=x20)
and (y=w[20,2])
then inc(x20,form1.Width+100);
//Punkt 20
if (x=x21)
and (y=w[21,2])
then inc(x21,form1.Width+100);
//Punkt 21
if (x=x22)
and (y=w[22,2])
then inc(x22,form1.Width+100);
//Punkt 22
if (x=x23)
and (y=w[23,2])
then inc(x23,form1.Width+100);
//Punkt 23
if (x=x24)
and (y=w[24,2])
then inc(x24,form1.Width+100);
//Punkt 24
if (x=x25)
and (y=w[25,2])
then inc(x25,form1.Width+100);
//Punkt 25
if (x=x26)
and (y=w[26,2])
then inc(x26,form1.Width+100);
//Punkt 26
if (x=x27)
and (y=w[27,2])
then inc(x27,form1.Width+100);
//Punkt 27
if (x=x28)
and (y=w[28,2])
then inc(x28,form1.Width+100);
//Punkt 28
if (x=x29)
and (y=w[29,2])
then inc(x29,form1.Width+100);
//Punkt 29
if (x=x30)
and (y=w[30,2])
then inc(x30,form1.Width+100);
//Punkt 30
if (x1>form1.Width)
and(x2>form1.Width)
and(x3>form1.Width)
and(x4>form1.Width)
and(x5>form1.Width)
and(x6>form1.Width)
and(x7>form1.Width)
and(x8>form1.Width)
and(x9>form1.Width)
and(x10>form1.Width)
and(x11>form1.Width)
and(x12>form1.Width)
and(x13>form1.Width)
and(x14>form1.Width)
and(x15>form1.Width)
and(x16>form1.Width)
and(x17>form1.Width)
and(x18>form1.Width)
and(x19>form1.Width)
and(x20>form1.Width)
and(x21>form1.Width)
and(x22>form1.Width)
and(x23>form1.Width)
and(x24>form1.Width)
and(x25>form1.Width)
and(x26>form1.Width)
and(x27>form1.Width)
and(x28>form1.Width)
and(x29>form1.Width)
and(x30>form1.Width)
then begin
canvas.Brush.Color:=fh;
canvas.rectangle(0,0,Form1.Height,Form1.Width);
Label1.Visible:=TRUE;
// da steht Sie haben gewonnen und so.
Label2.Visible:=TRUE;
bitbtn1.Visible:=True;
showmessage('
YOU WIN');
end else
if Key = ('
d')
then begin
//timer1.Enabled:=True; // TIMER EINSCHALTEN
Application.ProcessMessages;
if not (x>form1.Width-80)
then
inc(x,s);
c:=round((Form1.Width-x)/sin(45)*sin(90));
//Fur die Offnungsweite des Pie/maul
canvas.Brush.Color:=fh;
canvas.rectangle(0,0,Form1.Height,Form1.Width);
canvas.Pen.Color:=fh;
canvas.Brush.color:=clyellow;
canvas.Ellipse(x-r,y-r,x+r,y+r);
//Koerper
Waende;
canvas.Pen.Color:=fm;
canvas.Brush.color:=fm;
canvas.Pie(x-r,y-r,x+r,y+r,Form1.Width,y+c,Form1.Width,y-c);
sleep(t);
canvas.Pen.Color:=fh;
canvas.Brush.color:=clyellow;
canvas.Ellipse(x-r,y-r,x+r,y+r);
canvas.Pen.Color:=fm;
canvas.Brush.color:=fm;
canvas.Pie(x-r,y-r,x+r,y+r,Form1.Width,round(y+c/2),Form1.Width,round(y-c/2));
sleep(t);
canvas.Pen.Color:=fh;
canvas.Brush.color:=clyellow;
canvas.Ellipse(x-r,y-r,x+r,y+r);
canvas.Pen.Color:=fm;
canvas.Brush.color:=fm;
canvas.Pie(x-r,y-r,x+r,y+r,Form1.Width,round(y+c/4),Form1.Width,round(y-c/4));
sleep(t);
canvas.Pen.Color:=fh;
canvas.Brush.color:=clyellow;
canvas.Ellipse(x-r,y-r,x+r,y+r);
canvas.Pen.Color:=fm;
canvas.Brush.color:=fm;
canvas.Pie(x-r,y-r,x+r,y+r,Form1.Width,y,Form1.Width,y-1);
canvas.Pen.Color:=clyellow;
canvas.Moveto(x,y);
canvas.Lineto(x+r,y);
//Noch ein gelber Strich damit der Mund geschlossen wird
sleep(t);
canvas.Pen.Color:=fh;
canvas.Brush.color:=clyellow;
canvas.Ellipse(x-r,y-r,x+r,y+r);
canvas.Pen.Color:=fm;
canvas.Brush.color:=fm;
canvas.Pie(x-r,y-r,x+r,y+r,Form1.Width,round(y+c/4),Form1.Width,round(y-c/4));
sleep(t);
canvas.Pen.Color:=fh;
canvas.Brush.color:=clyellow;
canvas.Ellipse(x-r,y-r,x+r,y+r);
canvas.Pen.Color:=fm;
canvas.Brush.color:=fm;
canvas.Pie(x-r,y-r,x+r,y+r,Form1.Width,round(y+c/2),Form1.Width,round(y-c/2));
sleep(t);
canvas.Pen.Color:=fh;
canvas.Brush.color:=clyellow;
canvas.Ellipse(x-r,y-r,x+r,y+r);
canvas.Pen.Color:=fm;
canvas.Brush.color:=fm;
canvas.Pie(x-r,y-r,x+r,y+r,Form1.Width,y+c,Form1.Width,y-c);
end
//********************************(NACH LINKS)**********************************
else
if Key = '
a'
then begin
Application.ProcessMessages;
if x>40
then
dec(x,s);
c:=round(x/sin(45)*sin(90));
canvas.Brush.Color:=fh;
canvas.rectangle(0,0,Form1.Height,form1.Width);
canvas.Pen.Color:=fh;
canvas.Brush.color:=clyellow;
canvas.Ellipse(x-r,y-r,x+r,y+r);
Waende;
canvas.Pen.Color:=fm;
canvas.Brush.color:=fm;
canvas.Pie(x-r,y-r,x+r,y+r,0,y-c,0,y+c);
sleep(t);
canvas.Pen.Color:=fh;
canvas.Brush.color:=clyellow;
canvas.Ellipse(x-r,y-r,x+r,y+r);
canvas.Pen.Color:=fm;
canvas.Brush.color:=fm;
canvas.Pie(x-r,y-r,x+r,y+r,0,round(y-c/2),0,round(y+c/2));
sleep(t);
canvas.Pen.Color:=fh;
canvas.Brush.color:=clyellow;
canvas.Ellipse(x-r,y-r,x+r,y+r);
canvas.Pen.Color:=fm;
canvas.Brush.color:=fm;
canvas.Pie(x-r,y-r,x+r,y+r,0,round(y-c/4),0,round(y+c/4));
sleep(t);
canvas.Pen.Color:=fh;
canvas.Brush.color:=clyellow;
canvas.Ellipse(x-r,y-r,x+r,y+r);
canvas.Pen.Color:=fm;
canvas.Brush.color:=fm;
canvas.Pie(x-r,y-r,x+r,y+r,0,y,0,y+1);
canvas.Pen.Color:=clyellow;
canvas.Moveto(x,y);
canvas.Lineto(x-r,y);
sleep(t);
canvas.Pen.Color:=fh;
canvas.Brush.color:=clyellow;
canvas.Ellipse(x-r,y-r,x+r,y+r);
canvas.Pen.Color:=fm;
canvas.Brush.color:=fm;
canvas.Pie(x-r,y-r,x+r,y+r,0,round(y-c/4),0,round(y+c/4));
sleep(t);
canvas.Pen.Color:=fh;
canvas.Brush.color:=clyellow;
canvas.Ellipse(x-r,y-r,x+r,y+r);
canvas.Pen.Color:=fm;
canvas.Brush.color:=fm;
canvas.Pie(x-r,y-r,x+r,y+r,0,round(y-c/2),0,round(y+c/2));
sleep(t);
canvas.Pen.Color:=fh;
canvas.Brush.color:=clyellow;
canvas.Ellipse(x-r,y-r,x+r,y+r);
canvas.Pen.Color:=fm;
canvas.Brush.color:=fm;
canvas.Pie(x-r,y-r,x+r,y+r,0,y-c,0,y+c);
end
//********************************(NACH OBEN)***********************************
else
if Key = '
w'
then begin
Application.ProcessMessages;
if y>40
then
dec(y,s);
c:=round(y/sin(45)*sin(90));
canvas.Brush.Color:=fh;
canvas.rectangle(0,0,Form1.Height,form1.Width);
canvas.Pen.Color:=fh;
canvas.Brush.color:=clyellow;
canvas.Ellipse(x-r,y-r,x+r,y+r);
Waende;
canvas.Pen.Color:=fm;
canvas.Brush.color:=fm;
canvas.Pie(x-r,y-r,x+r,y+r,x+c,0,x-c,0);
sleep(t);
canvas.Pen.Color:=fh;
canvas.Brush.color:=clyellow;
canvas.Ellipse(x-r,y-r,x+r,y+r);
canvas.Pen.Color:=fm;
canvas.Brush.color:=fm;
canvas.Pie(x-r,y-r,x+r,y+r,round(x+c/2),0,round(x-c/2),0);
sleep(t);
canvas.Pen.Color:=fh;
canvas.Brush.color:=clyellow;
canvas.Ellipse(x-r,y-r,x+r,y+r);
canvas.Pen.Color:=fm;
canvas.Brush.color:=fm;
canvas.Pie(x-r,y-r,x+r,y+r,round(x+c/4),0,round(x-c/4),0);
sleep(t);
canvas.Pen.Color:=fh;
canvas.Brush.color:=clyellow;
canvas.Ellipse(x-r,y-r,x+r,y+r);
canvas.Pen.Color:=fm;
canvas.Brush.color:=fm;
canvas.Pie(x-r,y-r,x+r,y+r,x+1,0,x,0);
canvas.Pen.Color:=clyellow;
canvas.Moveto(x,y);
canvas.Lineto(x,y-r);
sleep(t);
canvas.Pen.Color:=fh;
canvas.Brush.color:=clyellow;
canvas.Ellipse(x-r,y-r,x+r,y+r);
canvas.Pen.Color:=fm;
canvas.Brush.color:=fm;
canvas.Pie(x-r,y-r,x+r,y+r,round(x+c/4),0,round(x-c/4),0);
sleep(t);
canvas.Pen.Color:=fh;
canvas.Brush.color:=clyellow;
canvas.Ellipse(x-r,y-r,x+r,y+r);
canvas.Pen.Color:=fm;
canvas.Brush.color:=fm;
canvas.Pie(x-r,y-r,x+r,y+r,round(x+c/2),0,round(x-c/2),0);
sleep(t);
canvas.Pen.Color:=fh;
canvas.Brush.color:=clyellow;
canvas.Ellipse(x-r,y-r,x+r,y+r);
canvas.Pen.Color:=fm;
canvas.Brush.color:=fm;
canvas.Pie(x-r,y-r,x+r,y+r,x+c,0,x-c,0);
end
//********************************(NACH UNTEN)**********************************
else
if Key = '
s'
then begin
Application.ProcessMessages;
if y<form1.Height-80
then
inc(y,s);
c:=round((Form1.Height-y)/sin(45)*sin(90));
canvas.Brush.Color:=fh;
canvas.rectangle(0,0,Form1.Height,form1.Width);
canvas.Pen.Color:=fh;
canvas.Brush.color:=clyellow;
canvas.Ellipse(x-r,y-r,x+r,y+r);
Waende;
canvas.Pen.Color:=fm;
canvas.Brush.color:=fm;
canvas.Pie(x-r,y-r,x+r,y+r,x-c,Form1.Height,x+c,Form1.Height);
sleep(t);
canvas.Pen.Color:=fh;
canvas.Brush.color:=clyellow;
canvas.Ellipse(x-r,y-r,x+r,y+r);
canvas.Pen.Color:=fm;
canvas.Brush.color:=fm;
canvas.Pie(x-r,y-r,x+r,y+r,round(x-c/2),Form1.Height,round(x+c/2),Form1.Height);
sleep(t);
canvas.Pen.Color:=fh;
canvas.Brush.color:=clyellow;
canvas.Ellipse(x-r,y-r,x+r,y+r);
canvas.Pen.Color:=fm;
canvas.Brush.color:=fm;
canvas.Pie(x-r,y-r,x+r,y+r,round(x-c/4),Form1.Height,round(x+c/4),Form1.Height);
sleep(t);
canvas.Pen.Color:=fh;
canvas.Brush.color:=clyellow;
canvas.Ellipse(x-r,y-r,x+r,y+r);
canvas.Pen.Color:=fm;
canvas.Brush.color:=fm;
canvas.Pie(x-r,y-r,x+r,y+r,x,Form1.Height,x+1,Form1.Height);
canvas.Pen.Color:=clyellow;
canvas.Moveto(x,y);
canvas.Lineto(x,y+r);
sleep(t);
canvas.Pen.Color:=fh;
canvas.Brush.color:=clyellow;
canvas.Ellipse(x-r,y-r,x+r,y+r);
canvas.Pen.Color:=fm;
canvas.Brush.color:=fm;
canvas.Pie(x-r,y-r,x+r,y+r,round(x-c/4),Form1.Height,round(x+c/4),Form1.Height);
sleep(t);
canvas.Pen.Color:=fh;
canvas.Brush.color:=clyellow;
canvas.Ellipse(x-r,y-r,x+r,y+r);
canvas.Pen.Color:=fm;
canvas.Brush.color:=fm;
canvas.Pie(x-r,y-r,x+r,y+r,round(x-c/2),Form1.Height,round(x+c/2),Form1.Height);
sleep(t);
canvas.Pen.Color:=fh;
canvas.Brush.color:=clyellow;
canvas.Ellipse(x-r,y-r,x+r,y+r);
canvas.Pen.Color:=fm;
canvas.Brush.color:=fm;
canvas.Pie(x-r,y-r,x+r,y+r,x-c,Form1.Height,x+c,Form1.Height);
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var i :integer;
begin
{canvas.Brush.Color:=clWhite; //MONSTER Versuch
canvas.Ellipse(mx-r,my-r,mx+r,my+r);
Application.ProcessMessages;
if x > mx then begin
repeat inc(mx,20) until mx=x end;
if x < mx then begin
repeat dec(mx,20) until mx=x end;
if y > my then begin
repeat inc(my,20) until my=y end;
if y < my then begin
repeat dec(my,20) until my=y end; }
end;
end.