Knaller ;D
Übersicht

![]() |
NinjaBetreff: Knaller ;D |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hier das passende BMax pendant zu meiner Knaller spielerei aus dem BB Codearchiv. Dank Bmax sieht aber alles besser aus und man kann mit den tasten 1 und 2 zwischen Böllern und Drehknallern wechseln. Viel spass ![]() [EDIT] Hier die neue version, es gibt nun Sprengpulver das man verteilen kann! So kann man kleine feuerwerkshows usw. machen Razz ich beschäftigte mich eben über eine stunde damit xD mfg Ninja [EDIT] Code: [AUSKLAPPEN] Graphics 800,600,16,60 Type knaller Field x#,y#,rot,bx#,by#,speed,alpha#,zund Field time Field link:TLink End Type Type expl Field x#,y#,bx#,by#,big#,g,alpha# Field link:TLink End Type Global liste1:TList = New TList Global liste2:TList = New TList Global liste3:TList = New TList Global liste4:TList = New TList Global liste5:TList = New TList Global a:knaller Global b:expl Global c:expl Global d:knaller Global e:knaller SetBlend(LIGHTBLEND) wahl = 1 Repeat Cls If MouseHit(1) = 1 Then If wahl = 1 Then a = New knaller a.x = MouseX() a.y = MouseY() a.rot = Rand(0,360) a.bx = 1 a.by = 1 a.time = 200 a.link = liste1.addlast(a:knaller) EndIf If wahl = 2 Then d = New knaller d.x = MouseX() d.y = MouseY() d.rot = Rand(0,360) d.bx = 1 d.by = 1 d.time = 500 d.speed = Rand(10,30) d.link = liste4.addlast(d:knaller) EndIf EndIf If MouseDown(1) Then If wahl = 3 Then e = New knaller e.x = MouseX() e.y = MouseY() e.alpha= 0.1 e.time = 100 e.link = liste5.addlast(e:knaller) EndIf EndIf 'SCHWEIZER For a = EachIn liste1 a.rot = a.rot + (a.bx*a.by)*15 SetRotation(a.rot) SetColor(0,200,0) DrawRect a.x,a.y-3,1,6 SetColor(200,200,200) SetRotation(0) a.x = a.x + a.bx a.y = a.y + a.by If a.bx > 0 Then a.bx = a.bx - 0.009 If a.bx < 0 Then a.bx = a.bx + 0.009 If a.by > 0 Then a.by = a.by - 0.009 If a.by < 0 Then a.by = a.by + 0.009 If a.zund = 1 Then a.time = a.time -1 If a.time > 0 And a.zund = 1 Then c = New expl c.x = a.x c.y = a.y c.bx = Sin(Rand(0,360)) c.by = Cos(Rand(0,360)) c.big = Rand(1,3) c.g = Rand(1,255) c.alpha = 1 c.link = liste3.addlast(c:expl) EndIf If a.time < 0 Then For I = 1 To 50 ' Explosionsgröße (50) b = New expl ' EXPLOSION ERZEUGEN b.x = a.x b.y = a.y b.bx = Sin(Rand(0,360))*2 b.by = Cos(Rand(0,360))*2 b.big = Rand(10,15) b.g = Rand(1,255) b.alpha = 0 b.link = liste2.addlast(b:expl) liste1.remove(a:knaller) Next EndIf Next ':-) 'Explosion For b = EachIn liste2 'Explosion Zeichnen ########################## SetAlpha(b.alpha) SetColor b.g,b.g-b.g/Rnd(1,3),0 DrawOval b.x,b.y,b.big,b.big b.big = b.big - 0.5 b.alpha = b.alpha + 0.05 b.x = b.x + b.bx b.y = b.y + b.by If b.big < 0 Then liste2.remove(b:expl) For e = EachIn liste5 'Pulver If rectsoverlap(e.x-5,e.y-5,10,10,b.x-b.big*2,b.y-b.big*2,b.big*5,b.big*5) = 1 Then e.time = e.time - 1 If e.time < 0 Then For I = 1 To 5 b = New expl ' b.x = e.x b.y = e.y b.x = e.x b.bx = Sin(Rand(0,360)) b.alpha = 0 b.by = Cos(Rand(0,360)) b.big = Rand(5,10) b.g = Rand(1,255) b.link = liste2.addlast(b:expl) liste5.remove(e:knaller) Next EndIf Next For a = EachIn liste1 ' Böller If rectsoverlap(a.x,a.y,1,1,b.x,b.y,10,10) = 1 Then a.zund = 1 Next For d = EachIn liste4 ' Drehknaller If rectsoverlap(d.x,d.y,1,1,b.x,b.y,10,10) = 1 Then d.zund = 1 Next Next ' Ende explosion ############################## SetAlpha(1) SetColor(255,255,255) For c = EachIn liste3 'flamme Drehknaller ######### SetAlpha(c.alpha) SetColor c.g,c.g,0 DrawOval c.x,c.y,c.big,c.big c.big = c.big - 0.1 c.alpha = c.alpha - 0.05 c.x = c.x + c.bx c.y = c.y + c.by If c.big < 0 Then liste3.remove(c:expl) Next ':___________________ SetAlpha(1) SetColor(255,255,255) For d = EachIn liste4 ' Drehknaller ################## SetColor(200,0,0) SetRotation(d.rot) DrawRect d.x,d.y,5,1 DrawRect d.x+1,d.y,1,5 SetRotation(0) d.x = d.x + d.bx d.y = d.y + d.by If d.bx > 0 Then d.bx = d.bx - 0.009 If d.bx < 0 Then d.bx = d.bx + 0.009 If d.by > 0 Then d.by = d.by - 0.009 If d.by < 0 Then d.by = d.by + 0.009 If d.zund = 1 Then d.time = d.time - 1 If d.time > 0 And d.zund = 1 Then d.rot = d.rot - d.speed For I = 1 To 3 b = New expl ' EXPLOSION ERZEUGEN b.x = d.x b.y = d.y b.bx = Sin(-d.rot) b.alpha = 0 b.by = Cos(-d.rot) b.big = Rand(5,10) b.g = Rand(1,255) b.link = liste2.addlast(b:expl) Next EndIf If d.time < 0 Then liste4.remove(d:knaller) Next SetAlpha(1) SetColor(255,255,255) For e = EachIn liste5 ' ### Pulver SetColor(50,50,50) SetAlpha(e.alpha) DrawOval e.x,e.y,5,5 Next 'Feuerzeug.......................------------- If MouseDown(2) = 1 Then For I = 1 To 10 b = New expl ' EXPLOSION ERZEUGEN b.x = MouseX() b.y = MouseY() b.alpha = 0 b.by = -1 b.big = Rand(1,10) b.bx = Rnd(-0.5,0.5) b.g = Rand(1,255) b.link = liste2.addlast(b:expl) Next EndIf SetAlpha(1) SetColor(255,255,255) If KeyHit(KEY_1) Then wahl = 1 If KeyHit(KEY_2) Then wahl = 2 If KeyHit(KEY_3) Then wahl = 3 DrawText "1-3 Wechseln, L Maustaste: Schiessen, R Maustaste: Feuerzeug",0,0 Flip FlushMem() Until KeyHit(KEY_ESCAPE) Function RECTSOVERLAP(X1,Y1,Breite1,Hoehe1,X2,Y2,Breite2,Hoehe2) If x1<=(x2+breite2) And y1<=y2+hoehe2 And (x1+breite1) >=x2 And (y1+hoehe1)>= y2 Then Return 1 Else Return 0 End Function |
||
- Zuletzt bearbeitet von Ninja am Mo, Jul 11, 2005 18:05, insgesamt 2-mal bearbeitet
![]() |
Ninja |
![]() Antworten mit Zitat ![]() |
---|---|---|
hab den neuen code einen beitrag darüber mit dem alten ersetzt ![]() |
||
- Zuletzt bearbeitet von Ninja am Mo, Jul 11, 2005 18:06, insgesamt einmal bearbeitet
![]() |
Artemis |
![]() Antworten mit Zitat ![]() |
---|---|---|
viel geiler als die bb-variante | ||
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group