Breakmeout + Abprallwinkel
Verfasst: 08.08.2006 18:17
Hi @all,
Ich versuche gerade mein erstes Spiel zu schreiben ich habe nur ein Problem das mit dem Abprallen+Winkel hinzubekommen.
Ich habe schon versuch Code aus dem archiv mit einzubauen aber anscheinend muss ich wohl noch mal ganz von vorne anfangen es sei denn jemand kann mir bei dem Problem helfen?
Hier ist mal der Source habe es auch noch ins web gestellt:
Der Link: www.leolasoft-herter.de/breakmeout.rar
Ich versuche gerade mein erstes Spiel zu schreiben ich habe nur ein Problem das mit dem Abprallen+Winkel hinzubekommen.
Ich habe schon versuch Code aus dem archiv mit einzubauen aber anscheinend muss ich wohl noch mal ganz von vorne anfangen es sei denn jemand kann mir bei dem Problem helfen?
Hier ist mal der Source habe es auch noch ins web gestellt:
Der Link: www.leolasoft-herter.de/breakmeout.rar
Code: Alles auswählen
Enumeration
#back
#back2
#back3
#first
#panel
#ball
#soundloop
#space
EndEnumeration
UseJPEGImageDecoder()
UseOGGSoundDecoder()
InitSprite()
InitKeyboard()
InitSound()
NewList breaks1.l()
NewList breaks2.l()
NewList breaks3.l()
NewList breaks4.l()
Structure entries
lives.l
EndStructure
Structure pos
top.l
left.l
winkel.l
EndStructure
;-leben
Dim leben.entries(0)
;-
Dim panel.pos(1)
panel(0)\top=500
panel(0)\left=350
Dim ball.pos(1)
ball(0)\top=450
ball(0)\left=400
ball(0)\winkel=0
For a=20 To 700 Step 85
AddElement(breaks1())
breaks1()=a
Next a
For a=60 To 700 Step 85
AddElement(breaks2())
breaks2()=a
Next a
For a=60 To 700 Step 85
AddElement(breaks3())
breaks3()=a
Next a
If OpenScreen(800,600,16,"")
;-Sprites
LoadSprite(#back,"img\linkecke.jpg")
LoadSprite(#back2,"img\untenoben.jpg")
LoadSprite(#back3,"img\rechtecke.jpg")
LoadSprite(#first,"img\line-red-yellow.jpg")
LoadSprite(#panel,"img\panel.jpg")
LoadSprite(#ball,"img\ball.jpg")
LoadSound(#soundloop,"sounds\trancemove.ogg")
LoadSound(#space,"sounds\space.wav")
;-
EndIf
PlaySound(#soundloop,1)
SoundFrequency(#soundloop, 32000)
ball=0
Repeat
ClearScreen(RGB(0,0,0))
ExamineKeyboard()
DisplayTransparentSprite(#back,0,0)
For a=5 To 795
DisplayTransparentSprite(#back2,a,0)
Next a
DisplayTransparentSprite(#back3,795,0)
ForEach breaks1()
DisplayTransparentSprite(#first,breaks1(),100)
Next
ForEach breaks2()
DisplayTransparentSprite(#first,breaks2(),125)
Next
ForEach breaks3()
DisplayTransparentSprite(#first,breaks3(),150)
Next
DisplayTransparentSprite(#panel,panel(0)\left,panel(0)\top)
DisplayTransparentSprite(#ball,ball(0)\left,ball(0)\top)
FlipBuffers()
If KeyboardPushed(#PB_Key_Right) And panel(0)\left<680
PlaySound(#space)
panel(0)\left=panel(0)\left+3
EndIf
If KeyboardPushed(#PB_Key_Left) And panel(0)\left>10
PlaySound(#space)
panel(0)\left=panel(0)\left-3
EndIf
If KeyboardPushed(#PB_Key_Space)
ball=1
EndIf
If ball=1 And ball(0)\top<555 And ballsp=0
If ball=1 And ball(0)\top>5 And ballsp=1
ball(0)\top=ball(0)\top-4
ball(0)\left=ball(0)\left+ball(0)\winkel
ballsp=1
Else
ballsp=0
EndIf
Else
If ball=1 And ball(0)\top>5 And ballsp=1
ball(0)\top=ball(0)\top-4
ball(0)\left=ball(0)\left+ball(0)\winkel
ballsp=1
Else
ballsp=0
EndIf
EndIf
If ball=1 And ball(0)\top<555 And ballsp=0
ball(0)\top=ball(0)\top+4
ball(0)\left=ball(0)\left+ball(0)\winkel
ballsp=0
Else
ballsp=1
EndIf
If SpritePixelCollision(#panel,panel(0)\left,panel(0)\top,#ball,ball(0)\left,ball(0)\top)
ball=1:ballsp=1
EndIf
ForEach breaks1()
If SpritePixelCollision(#ball,ball(0)\left,ball(0)\top,#first,breaks1(),100):Debug "xxx"
DeleteElement(breaks1())
ball=1:ballsp=0
EndIf
Next
ForEach breaks2()
If SpritePixelCollision(#ball,ball(0)\left,ball(0)\top,#first,breaks2(),125):Debug "xxx"
DeleteElement(breaks2())
ball=1:ballsp=0
EndIf
Next
ForEach breaks3()
If SpritePixelCollision(#ball,ball(0)\left,ball(0)\top,#first,breaks3(),150):Debug "xxx"
DeleteElement(breaks3())
ball=1:ballsp=0
EndIf
Next
If KeyboardPushed(#PB_Key_Escape) ; drücken Sie Esc zum Beenden
End
EndIf
ForEver