Ballergame "Alien-Invasion" für den 20 Lines Contest
Verfasst: 14.09.2009 22:45
Hallo zusammen,
im englischen Forum gibts ja den 20 lines Contest, bei dem das Ziel ist, möglichst tolle Programme verschiedener Kategorien in einem 20-Zeiler unterzubringen.
Ich hatte mich zu diesem Contest an ein Ballergame gemacht.
Leider habe ich es nicht auf weniger als 29 Codezeilen a 80 Zeichen gebracht ohne das Gameplay vollends zu ruinieren.
Damit bin ich leider disqualifiziert im 20-Zeilen-Contest.
Aber macht nix, hat trotzdem Spaß gemacht.
Und damit auch die Leute was davon haben, die nicht in das englische Forum gucken, poste ich das hier einfach mal.
Der Code ist compilierbar mir PB 4.31. Das Game benötigt noch eine Bild- und eine Sounddatei.
Die bekommt ihr HIER
Die Bedienung ist recht einfach:
- Mit der Maus steuert Ihr Euer Raumschiff
- Mit Space feuert man seine Laserwaffe ab
- ESC beendet das Spiel
Hier noch ein paar Screenshoots:


So und hier das wichtigste... 29 Zeilen Ballergame.
Viel Spaß
Edit 22.09.2009: Die Kollisionserkennung mit den Schüssen war noch falsch. Habe es jetzt korrigiert. Bitte ggf. nochmal rauskopieren.
im englischen Forum gibts ja den 20 lines Contest, bei dem das Ziel ist, möglichst tolle Programme verschiedener Kategorien in einem 20-Zeiler unterzubringen.
Ich hatte mich zu diesem Contest an ein Ballergame gemacht.
Leider habe ich es nicht auf weniger als 29 Codezeilen a 80 Zeichen gebracht ohne das Gameplay vollends zu ruinieren.
Damit bin ich leider disqualifiziert im 20-Zeilen-Contest.
Aber macht nix, hat trotzdem Spaß gemacht.
Und damit auch die Leute was davon haben, die nicht in das englische Forum gucken, poste ich das hier einfach mal.
Der Code ist compilierbar mir PB 4.31. Das Game benötigt noch eine Bild- und eine Sounddatei.
Die bekommt ihr HIER
Die Bedienung ist recht einfach:
- Mit der Maus steuert Ihr Euer Raumschiff
- Mit Space feuert man seine Laserwaffe ab
- ESC beendet das Spiel
Hier noch ein paar Screenshoots:


So und hier das wichtigste... 29 Zeilen Ballergame.

Viel Spaß
Code: Alles auswählen
;*******************************************************************************
;*
;* Name : Alien-Invasion
;* Author : Kurzer
;* Category : Game
;* Date : 12. September 2009
;*
;* Notes : At first: Sorry, I know I exceed the limit of 20 lines. This game
;* needs 29 lines. But I don't want to remove some of the functions,
;* because the gameplay would fall in quality.
;*
;* So I'm disqualified for this contest, but hey... never mind!
;* It was a big challenge for me and it was a lot of fun even it was
;* really hard work (especially downsizing the code).
;* And finally you can play an exciting arcade game . ;-)
;*
;* The game was exclusively written for the 20 lines contest!
;*
;* Gameplay : You are the commander of a small, fast spaceship and your order
;* is to save the earth. :-) Enemy troops from outer space try to
;* attack our planet. Go and save the mankind, Warrior! ;-)
;*
;* Control : Control your ship with your mouse. Fire your missiles with the
;* SPACE-key. To quit the game simply press the ESC-key.
;*
;* The aliens appears at the top of the screen. They attack you
;* in serveral stages/waves.
;*
;* Try to destroy as many alien ships as possible. But keep an eye
;* on your energy. Every shoot you fire off will cost you 2 energy
;* points. But every hit to an alien ship will credit 1 point.
;* If you destroy a ship your energy will increase by [level] points.
;* That means if you destroy a ship in level 14 you will get 14 points.
;* If you collide with an alien ship this will cost 40 points in every
;* level.
;*
;* The goal of the game is to solve all 35 Levels and get as many energy
;* points as possible.
;* The game ends if your energy falls below 0 points.
;* (you start your mission with 50 points)
;* The game also ends if you mastered all the levels. The animation
;* will stop then and only the backgroundmusic will play furthermore.
;*
;* And now... good luck and much fun!
;*
;* Kind Regards, Kurzer.
;*
;* Ressources:
;* You need a bitmapfile named "P.bmp" and a aoundfile named "S.ogg".
;* Attend the link in my forum-posting.
;*
;* Sounds: www.freesound.org
;* Music: www.podsafeaudio.com, Title: Proteus, Artist: George Wood
;* Grafix: Grabbed somewhere from the internet. ;^)
;*******************************************************************************
;<-------------------------------- 80 chars ----------------------------------->
Macro M(a,b):Macro a:b:EndMacr:EndMacro:#D=600:J=20:Macro O(a,b,c):Macro a(b):c:
EndMacr:EndMacro:Dim B.f(50,3):Dim C.f(#D,2):Dim A(50,1):D=50:InitKeyboard();...
M(Z,ClipSprite)o:M(K,KeyboardPushed)o:M(S,CatchSound)o:M(R,SpriteCollision)o;...
M(P,PlaySound)o:M(V,DisplayTransparentSprite)o:O(AA,n,For n=0 To)o:M(AB,Next)o;.
M(AF,StartDrawing(ScreenOutput()))o:M(AH,DrawingMode(1))o:M(AK,Random)o:#C=650;.
M(AD,EndIf)o:M(AE,PlaySound)o:M(AG,StopDrawing())o:M(AI,DrawText)o:M(Q,If)o:I=64
InitSound():InitSprite():O(L,n,LoadSprite(n,"P.bmp"))o:OpenScreen(800,#D,16,"");
M(AJ,And)o:UseOGGSoundDecoder():H=32:InitMouse():AA(T)#D:C(T,0)=AK(799):#B=512;.
C(T,1)=AK(599):C(T,2)=0.1+(AK(10)/20):AB:S(1,?S+$2AAB,$4D38):S(2,?S+$77E3,$193E)
L(1):Z(1,0,0,H,H):L(0):Z(0,H,0,H,H):L(2):Z(2,I,0,H,H):L(3):Z(3,96,0,H,H):L(4);..
L(5):L(6):L(7):L(8):Z(4,128,0,I,H):Z(5,192,0,I,H):Z(6,256,0,I,H):Z(7,320,0,I,H);
L(9):L(10):Z(8,384,0,I,H):Z(9,256,H,210,H):S(3,?S+$9121,$3B02):Z(10,0,I,#B,448);
S(4,?S+$CC23,$84D0B):P(4,1):AA(T) 7:L(T+J):Z(T+J,T*H,H,H,H):AB:*A.WORD=?S+$9192E
S(0,?S,$2AAB):Repeat:ExamineMouse():ExamineKeyboard():X=MouseX():Y=MouseY();....
Q X>768:X=768:AD:Q Y<400:Y=400:AD:Q Y>568:Y=568:AD:MouseLocate(X,Y):G=K(57);....
Q D>=0 AJ F>-1:Q G:Q J=0:AE(0):S+1:D-2:A(S,0)=X:A(S,1)=Y:Q S=50:S=0:AD:AD:J+1:AD
Q G=0 Or J=15-O:J=0:AD:E+1:Q E>=F:F=*A\w:*A+2:W+1:Q F>0:AE(3):U=*A\w:*A+2:P=*A\w
*A+2:O=*A\w:*A+2:N=*A\w:*A+2:M=*A\w:*A+2:AA(T) M:B(T,0)=60+AK(#D):B(T,2)=U:;....
B(T,1)=AK(15*M)*-1:B(T,3)=O:AB:AD:AD:ClearScreen(0):AF:AA(T)#D:H=288:I=152;.....
Plot(C(T,0),C(T,1),$111111*Round(C(T,2)*15,0)):Q C(T,0)<797:C(T,0)+C(T,2):Else;.
C(T,0)=0:AD:AB:AG:V(10,H,I):AA(T) M:Q B(T,1)<#C:Z=Sin((B(T,1))/70)*(N+C(T,1)/15)
H=B(T,0)+Z:I=B(T,1)+Sin(H/70)*80:V(B(T,2),H,I):B(T,1)+P/2:AF:AH:#E=570:#F=$88ff;
AI(H+9,I-15,Str(B(T,3)),#F):AG:Q R(B(T,2),H,I,0,X,Y)<>0 AJ B(T,3)>0:B(T,3)=0;...
D-50:AD:AA(U) 50:Q R(B(T,2),H,I,1,A(U,0),A(U,1))<>0 AJ A(U,1)>0 AJ B(T,3)>0
B(T,1)-2:B(T,3)-1:A(U,1)=-1:D+1:AE(2):AD:AB:Q B(T,3)=0 AJ E%4=0:Q B(T,2)<20;....
AE(1):B(T,2)=20:AD:B(T,2)+1:Q B(T,2)=28:B(T,1)=#C:D+W:AD:AD:AD:AB:AA(T) 50;.....
Q A(T,1)>0:V(1,A(T,0),A(T,1)):Q A(T,1)>0:A(T,1)-15:AD:AD:AB:V(0,X,Y):V(9,#E,10);
AF:AH:AI(110,12,"Energy: "+Str(D),#F,0):AI(10,12,"Level: "+Str(W)+"/36",#F,0):AG
FlipBuffers():AD:Until K(1):DataSection:S:IncludeBinary "S.ogg":EndDataSection;.