Verfasst: 07.03.2008 20:59
Hier ein Source Code von Epyx (ist viel besser als meinerRocketRider hat geschrieben:Wow![]()
Für eine Stunde echt nicht Schlecht.
Kann ich den Quelltext haben?

Ich habe in gleich mal an PB4.x angepasst (Sourcen für den Sound habe ich aber teilweise entfernt!!!
Code: Alles auswählen
;##########################################
;## ##
;## CaveFlight EP by Epyx ##
;## ##
;## visit me at www.flasharts.de/epyx ##
;## or come to www.compuprog.de ##
;## ##
;## the FMOD.DLL-import for PB is needed ##
;## ##
;##########################################
;### Initialize some stuff
#FSOUND_LOADMEMORY = $8000
X= InitSprite() : If X=0 : MessageRequester("DirectX Error","Cannot Initialize DirectX - Direct Draw"+Chr(13)+"You need at least DX7 to run this game",#MB_ICONERROR) : End : EndIf
X= InitKeyboard()
X= InitMouse()
UseJPEGImageDecoder()
;### Prepare the arrays
Dim OB(400) : Dim UN(400)
;### Open up our window for the game
hWnd=OpenWindow(0,0,0,400,300,"",#PB_Window_SystemMenu|#PB_Window_WindowCentered)
X=OpenWindowedScreen(hWnd,0,0,400,300,0,0,0)
; SetFrameRate(60)
;### Get all our used sprites
X =CatchSprite(1,?Back)
X =CatchSprite(2,?Front)
X =CatchSprite(3,?Bird)
X =CatchSprite(4,?Title,0)
X =CatchSprite(5,?Water)
X =CatchSprite(6,?Blub)
;### The Structures
Structure Parti
x.l
y.l
AddX.l
AddY.l
Red.l
Green.l
Blue.l
EndStructure
Structure Blasen
x.l
y.l
AddX.l
AddY.l
EndStructure
NewList Partikel.Parti()
NewList Blub.Blasen()
;### Setup the game variables
Runner:
RandomSeed(766653)
Oben=0 : Unten=0 : Bird_Y=150 : Kucks=0 : YY=-3
Waterlevel=200 : pi=3.141513
For t=0 To 400
Rnd1=Random(2) : Rnd2=Random(2) : Rnd3=Random(5)
If Rnd1=0 : Oben-Rnd3 : If Oben<0 : Oben=0 : EndIf : EndIf
If Rnd1=2 : Oben+Rnd3 : If Oben>130 : Oben=50 : EndIf : EndIf
If Rnd2=0 : Unten-Rnd3 : If Unten<0 : Unten=0 : EndIf : EndIf
If Rnd2=2 : Unten+Rnd3 : If Unten>130 : Unten=50 : EndIf : EndIf
OB(t)=Oben : UN(t)=Unten
Next t
;### Game menü
Repeat
Eve = WindowEvent()
Select Eve
Case #PB_Event_CloseWindow
End
EndSelect
ExamineKeyboard() : ExamineMouse()
If KeyboardPushed(#PB_Key_Escape) : End : EndIf
If KeyboardPushed(#PB_Key_Return) : Kucks=1 : EndIf
If MouseButton(1) : Kucks=1 : EndIf
DisplaySprite(4,0,0)
StartDrawing(ScreenOutput())
DrawingMode(1) : FrontColor($FFFFFF)
DrawText(300,3,"Punkte: "+Str(Punkte))
DrawText(10,280,"Linke Maustaste oder Cursor UP - Escape zum Beenden")
StopDrawing()
FlipBuffers()
Until (Kucks<>0)
Punkte=0
;### Hauptschleife ####
Repeat
;### Check for windows events
Eve= WindowEvent()
Select Eve
Case #PB_Event_CloseWindow
End
EndSelect
;### Get the keyboard and mouse state
ExamineKeyboard() : ExamineMouse()
Taste = KeyboardPushed(#PB_Key_Escape)
If (KeyboardPushed(#PB_Key_Up)) Or (MouseButton(1)) : KUP=1 : EndIf
If (KeyboardPushed(#PB_Key_Down)) Or (MouseButton(2)) : KAP=1 : EndIf
;### Draw the background and water
g-1 : If g<1 : XX-1 : g=2 : EndIf
If XX=-300 : XX=0 : EndIf
For t=0 To 2 : ClipSprite(1,0,0, 400,Waterlevel) : DisplaySprite(1, XX+(t*300),0)
For z=0 To 400 : ClipSprite(5,z,Waterlevel,1,300-Waterlevel)
Si+3 : Water_Y=WaterLevel+(Sin(Si * pi / 180) * 3)
DisplaySprite(5, XX+(t*300)+z,Water_Y)
Next z : Si-400*3 : Next t
Start+1 : If Start=400 : Start=0 : EndIf
ClipSprite(3,(Anim*16), 0, 16,16) :
IQ+1 : If IQ=5 : Anim+1 : IQ=0 : If Anim=5 : Anim=0 : EndIf : EndIf
DisplayTransparentSprite(3,100,Bird_Y)
;### Move the bubbles in the water
ResetList(Blub())
While NextElement(Blub())
Blub()\y = Blub()\y + Blub()\AddY
Blub()\x = Blub()\x -1 + (1-Random(2))
DisplayTransparentSprite(6,Blub()\x,Blub()\y)
If Blub()\y<Waterlevel : DeleteElement(Blub()) : EndIf
Wend
;### Draw the cave on the Screen
Cave_X=Start
For t=0 To 400 : Cave_X+1 : If Cave_X=400 : Cave_X=0 : EndIf
ClipSprite(2,Cave_X, 0, 1, OB(Cave_X)) : DisplaySprite(2,t,0)
If SpritePixelCollision(2, t,0, 3, 100, Bird_Y) : Taste=1 : EndIf
ClipSprite(2,Cave_X, 300-UN(Cave_X), 1, UN(Cave_X)) : DisplaySprite(2,t,(300-UN(Cave_X)))
If SpritePixelCollision(2, t,300-UN(Cave_X), 3, 100, Bird_Y) : Taste=1 : EndIf
Next t
;### put some random numbers in the arrays
Rnd1=Random(2) : Rnd2=Random(2) : Rnd3=Random(3) : Rnd4=Random(5)
If Rnd1=0 : Oben-Rnd4 : If Oben<0 : Oben=0 : EndIf : EndIf
If Rnd1=2 : Oben+Rnd4 : If Oben>150 : Oben=150 : EndIf : EndIf
If Rnd2=0 : Unten-Rnd4 : If Unten<0 : Unten=0 : EndIf : EndIf
If Rnd2=2 : Unten+Rnd4 :
If Unten>250 : Unten=150 : EndIf :
If (Oben+32)<(unten-32) : Unten-50 : EndIf
EndIf
If Rnd3=0 : Waterlevel-1 : If Waterlevel<0 : Waterlevel=0 : EndIf : EndIf
If Rnd3=2 : Waterlevel+1 : If Waterlevel>300 : Waterlevel=300 : EndIf : EndIf
OB(Cave_X)=Oben : UN(Cave_X)=Unten
;### Uhh the bird falls in the water, add some particels
If (Bird_Y>(waterlevel-3)) And (Bird_Y<(waterlevel+3))
For f=0 To 24
AddElement(Partikel())
Partikel()\x =110
Partikel()\y =Bird_Y
Partikel()\AddX =(-3)+(Random(6))
Partikel()\AddY =(0-(Random(YY)*2))-1
Next
EndIf
;### Add points and limit movement
Bird_Y=Bird_Y+YY : Punkte+1
If Bird_Y>300 : Taste=1 : EndIf
If Bird_Y<0 : Taste=1 : EndIf
;### Add a Bubble in the Water
AddElement(Blub())
Blub()\x =Random(500)
Blub()\y =300
Blub()\AddY =(0-(Random(1))-1)
;### Move the Bird
Gravity+1 : If Gravity=12
If Bird_Y<Waterlevel : YY+1 : EndIf
If Bird_Y>Waterlevel : YY-1 : EndIf
If Kup=1 : YY-2 : Kup=0 : EndIf : Gravity=0
If Kap=1 : YY+2 : Kap=0 : EndIf : Gravity=0
If YY>3 : YY=3 : EndIf : If YY<-3 : YY=-3 : EndIf
EndIf
;### Draw the Particels
StartDrawing(ScreenOutput())
ResetList(Partikel())
While NextElement(Partikel())
Partikel()\y = Partikel()\y + Partikel()\AddY
Partikel()\x = Partikel()\x + Partikel()\AddX
If Partikel()\y<0 : Partikel()\y=0 : EndIf
If Partikel()\y>300 : Partikel()\y=300 : EndIf
If Partikel()\x>400 : Partikel()\x=400 : EndIf
If Partikel()\x<0 : Partikel()\x=0 : EndIf
Plot (Partikel()\x, Partikel()\y ,RGB(200,200,255))
If Partikel()\AddY<10 : Partikel()\AddY=Partikel()\AddY+1 : EndIf
If Partikel()\y>Waterlevel : DeleteElement(Partikel()) : EndIf
Wend
StopDrawing()
;### Let us see the show on the screen
Gosub FPS
FlipBuffers()
Until (Taste<>0)
Delay(500)
Kup=0 : Kap=0
Goto Runner
;### Calculate the Frames per second
FPS:
If Val(FormatDate("%ss", Date()))=sec
Frames+1:Else:Frames$=Str(Frames):Frames=0:EndIf
sec=Val(FormatDate("%ss", Date()))
StartDrawing(ScreenOutput())
DrawingMode(1) : FrontColor($FFFFFF)
DrawText(5,5,"fps: "+Frames$)
DrawText(350,280,Str(Punkte))
StopDrawing()
Return
;### The Datas
Title: IncludeBinary "CaveTitle.Jpg"
Back: IncludeBinary "CaveBG.jpg"
Water: IncludeBinary "Cavewater.jpg"
Front: IncludeBinary "CaveFront.jpg"
Bird: IncludeBinary "bird.bmp"
Blub: IncludeBinary "blub.bmp"
Music: IncludeBinary "Pco.mod"