From 8387033441e81f1eca92ae79a23a950562ca2bf9 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Wed, 9 Mar 2016 21:45:36 +0100 Subject: [PATCH] init commit --- Snake.cfg | 35 ++++++++++ Snake.dof | 87 ++++++++++++++++++++++++ Snake.dpr | 13 ++++ Snake.res | Bin 0 -> 876 bytes uMain.dfm | 44 ++++++++++++ uMain.pas | 197 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 376 insertions(+) create mode 100644 Snake.cfg create mode 100644 Snake.dof create mode 100644 Snake.dpr create mode 100644 Snake.res create mode 100644 uMain.dfm create mode 100644 uMain.pas diff --git a/Snake.cfg b/Snake.cfg new file mode 100644 index 0000000..f498d4b --- /dev/null +++ b/Snake.cfg @@ -0,0 +1,35 @@ +-$A8 +-$B- +-$C+ +-$D+ +-$E- +-$F- +-$G+ +-$H+ +-$I+ +-$J- +-$K- +-$L+ +-$M- +-$N+ +-$O+ +-$P+ +-$Q- +-$R- +-$S- +-$T- +-$U- +-$V+ +-$W- +-$X+ +-$YD +-$Z1 +-cg +-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; +-H+ +-W+ +-M +-$M16384,1048576 +-K$00400000 +-LE"d:\programming\delphi\delphi6\Projects\Bpl" +-LN"d:\programming\delphi\delphi6\Projects\Bpl" diff --git a/Snake.dof b/Snake.dof new file mode 100644 index 0000000..18a993c --- /dev/null +++ b/Snake.dof @@ -0,0 +1,87 @@ +[FileVersion] +Version=6.0 +[Compiler] +A=8 +B=0 +C=1 +D=1 +E=0 +F=0 +G=1 +H=1 +I=1 +J=0 +K=0 +L=1 +M=0 +N=1 +O=1 +P=1 +Q=0 +R=0 +S=0 +T=0 +U=0 +V=1 +W=0 +X=1 +Y=1 +Z=1 +ShowHints=1 +ShowWarnings=1 +UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; +[Linker] +MapFile=0 +OutputObjs=0 +ConsoleApp=1 +DebugInfo=0 +RemoteSymbols=0 +MinStackSize=16384 +MaxStackSize=1048576 +ImageBase=4194304 +ExeDescription= +[Directories] +OutputDir= +UnitOutputDir= +PackageDLLOutputDir= +PackageDCPOutputDir= +SearchPath= +Packages= +Conditionals= +DebugSourceDirs= +UsePackages=0 +[Parameters] +RunParams= +HostApplication= +Launcher= +UseLauncher=0 +DebugCWD= +[Language] +ActiveLang= +ProjectLang= +RootDir= +[Version Info] +IncludeVerInfo=0 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 +Locale=1031 +CodePage=1252 +[Version Info Keys] +CompanyName= +FileDescription= +FileVersion=1.0.0.0 +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion=1.0.0.0 +Comments= diff --git a/Snake.dpr b/Snake.dpr new file mode 100644 index 0000000..2f89ff8 --- /dev/null +++ b/Snake.dpr @@ -0,0 +1,13 @@ +program Snake; + +uses + Forms, + uMain in 'uMain.pas' {fMain}; + +{$R *.res} + +begin + Application.Initialize; + Application.CreateForm(TfMain, fMain); + Application.Run; +end. diff --git a/Snake.res b/Snake.res new file mode 100644 index 0000000000000000000000000000000000000000..b111060100a5f025f8352346a52aa105dda315dc GIT binary patch literal 876 zcmaJ=Jxc>Y5Pj=~+s-6tVP#TUMl38+L=gfOYT+L^n{Cnvf+wW#s%rxNnLu)|%~k%6 zl$I$|i0j+gyL{lskhe2$=FRS8xdnhO;amX29sAg;>k&0dYOR)T)S?pxUE+dJsM75D z-7YQoTL`ZNskJunM9$J{ZiL4pI|=o`jj8rCvcaPfMain.Width) then timer.Enabled:=False; + if (Snake[0].Top<10) then timer.Enabled:=False; + if (Snake[0].Top+Snake[0].Height+60>fMain.Height) then timer.Enabled:=False; + + //Self + for i:=1 to Length(Snake)-1 do + if (Snake[0].Top=Snake[i].Top) and (Snake[0].Left=Snake[i].Left) then timer.Enabled:=False; + + //Dot + if (Snake[0].Left+Snake[0].width>=Dots[0].Left) and (Snake[0].Left<=Dots[0].Left+Dots[0].Width) and (Snake[0].Top+Snake[0].Height>=Dots[0].Top) and (Snake[0].Top<=Dots[0].Top+Dots[0].Height) then + begin + Inc(Points,1000+random(1000)); + Dots[0].Free; + SetLength(Dots,0); + //Neues Schlangenglied + SetLength(Snake,Length(Snake)+1); + Snake[Length(Snake)-1]:=TShape.create(fMain); + Snake[Length(Snake)-1].Parent:=fMain; + Snake[Length(Snake)-1].Shape:=stRoundRect; + Snake[Length(Snake)-1].Width:=10; + Snake[Length(Snake)-1].Height:=10; + Snake[Length(Snake)-1].Top:=LastPosY; + Snake[Length(Snake)-1].Left:=LastPosX; + end; + + + Inc(Points,Random(2)); + + label1.Caption:='Punkte: '+inttostr(Points); + +end; + +procedure TfMain.Spielneustarten1Click(Sender: TObject); +begin + + StartGame; + +end; + +end.