Feuerwerk
Übersicht

![]() |
SchnittlauchUnkrautBetreff: Feuerwerk |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hi
Ich hatte 2 Tage zeit am Wochenende (oh, wunder) und in der zeit hab ich dieses Proggie gecodet. Erstmal die EXE für nicht Bmaxer: https://www.blitzforum.de/upload/file.php?id=904 So, jzn der Code: Main.bmx Code: [AUSKLAPPEN] SuperStrict Framework brl.basic Import brl.blitz Import brl.max2d Import brl.audio 'Import brl.audiosample 'Import pub.freeaudio Import brl.freeaudioaudio Import brl.wavloader Import brl.glmax2d Import brl.pngloader Global AppTitle$ = "Happy new Year!" Include "types.bmx" SeedRnd MilliSecs() Global fulls:Byte = Proceed("Wollen sie im Vollbild Modus starten?",False) IncBin "spark.png" IncBin "rocket.png" IncBin "bottlerocket.wav" IncBin "launch2.wav" IncBin "launch3.wav" IncBin "explo1.wav" 'IncBin "launch.mp3" 'Global fulls:Byte = 0 SetGraphicsDriver GLMax2DDriver() if fulls:Byte = 0 Then Graphics 1024,768 ElseIf fulls:Byte = 1 Then Graphics 1024,768,16 Else End End if Global spark:TImage = LoadImage("INCBIN::spark.png",FILTEREDIMAGE) Global rakete:TImage = LoadImage("INCBIN::rocket.png",FILTEREDIMAGE) Global start:TSound[3] start[0] = LoadSound("INCBIN::bottlerocket.wav") start[1] = LoadSound("INCBIN::launch2.wav") start[2] = LoadSound("INCBIN::launch3.wav") Global explos:TSound[3] explos[0] = LoadSound("INCBIN::explo1.wav") Global startfct:Int = MilliSecs() Global framecount:Int = 0 Global FPS:Int = 60 Global starfield:TStarfield = New TStarfield Global explo:TFireworkEmit = New TFireworkEmit 'explo.Emit(1024/2,768/2,0,0,0,1000) Global startfwcount:Int = MilliSecs() Global starttime:Int = 500 SetScale(8,8) While not KeyHit(KEY_ESCAPE) Cls starfield.Draw() explo.Draw() SetScale(1,1) DrawText(FPS:Int,0,0) Flip framecount = framecount + 1 if MilliSecs() - startfwcount > starttime Then explo.Emit(Rnd(0,1024),Rnd(0,368),Rnd(0,255),Rnd(0,255),Rnd(0,255),1000) startfwcount = MilliSecs() starttime = Rnd(400,800) End if if MilliSecs() - startfct:Int > 1000 Then FPS:Int = framecount:Int framecount:Int = 0 startfct = MilliSecs() End If Wend types.bmx Code: [AUSKLAPPEN] Type TStarfield Field stars:Float[501,4] Method Draw() Local star:Int For star:Int = 1 to 500 'Local col:Byte = Rnd(50,230) 'SetColor col,col,col SetColor stars[star,3],stars[star,3],stars[star,3] Plot stars[star,1],stars[star,2] stars[star,1] = stars[star,1] - 0.01 if stars[star,1] < 0 Then stars[star,1] = 1024 'stars[star,2] = stars[star,2] + 0.1 SetColor 255,255,255 Next End Method Method New() Local star:Int For star:Int = 1 to 500 stars[star,1] = Rnd(0,1024) stars[star,2] = Rnd(0,768) stars[star,3] = Rnd(50,230) Next End Method End Type Type TFireworkEmit Field sparklist:TList = CreateList() Field rocklist:TList = CreateList() Field scolor_r:Byte,scolor_g:Byte,scolor_b:Byte Field emx:Float Field emy:Float Method Emit(x:Float,y:Float,r:Byte,g:Byte,b:Byte,sparks:Int=500) Local rocket:TRocket = New TRocket rocket.x = Rnd(0,1024) rocket.y = 768 rocket.speed = Rnd(-5,-10) rocket.tarx = x rocket.tary = y rocket.r = r rocket.g = g rocket.b = b rocket.chan = PlaySound(start[Rnd(0,3)],rocket.chan) rocket.chan.SetVolume(0.2) rocklist.AddFirst(rocket) rocket = Null End Method Method Emitfw(rocket:TRocket,sparks:Int=1000) Local spark:Int For spark = 0 to sparks Local s:TSpark = New TSpark s.x = rocket.x s.y = rocket.y s.winkel = Rnd(0.0,360.0) s.speedx = Rnd(0,16.0) s.speedy = Rnd(0,16.0) s.mxlive = Rnd(0.02,0.1) s.alpha = 1 s.r = rocket.r s.g = rocket.g s.b = rocket.b sparklist.AddFirst(s) s = Null Next rocket.chan = PlaySound(explos[0]) rocket.chan.SetDepth(Rnd(0,2)) rocklist.Remove(rocket) rocket = Null End Method Method Draw() Local s:TSpark = New TSpark Local rocket:TRocket = New TRocket SetBlend(LIGHTBLEND) For s = EachIn(sparklist) SetScale(s.alpha*8,s.alpha*8) SetAlpha s.alpha SetColor s.r,s.g,s.b s.x = s.x + Cos(s.winkel)*s.speedx s.y = s.y + Sin(s.winkel)*s.speedy 's.speedy = s.speedy + 0.2 if s.alpha > 0 Then s.alpha = s.alpha - s.mxlive 's.speedx = s.speedx + 0.3 DrawImage(spark,s.x,s.y) DrawImage(spark,s.x,s.y) if s.alpha <= 0 Then sparklist.Remove(s) Next SetScale(1,1) SetColor 255,255,255 SetAlpha(1) For rocket = EachIn rocklist rocket.y = rocket.y + Sin(rocket.winkel)*rocket.speed rocket.x = rocket.x + Cos(rocket.winkel)*rocket.speed 'rocket.speedx = ATan2(rocket.x,rocket.tarx) 'rocket.speedy = ATan2(rocket.y,rocket.tary) rocket.winkel = ATan2(rocket.x-rocket.tarx,(rocket.y-rocket.tary)*-1) -90 SetScale(1,1) SetRotation(rocket.winkel-90) DrawImage(rakete,rocket.x,rocket.y) SetScale(8,8) SetRotation(0) if rocket.y <= rocket.tary Then Emitfw(rocket) End if Next End Method End Type Type TSpark Field winkel:Float Field x:Float Field y:Float Field speedx:Float Field speedy:Float Field mxlive:Float Field alpha:Float = 1 Field r:Byte,g:Byte,b:Byte End Type Type TRocket Field chan:TChannel Field x:Float Field y:Float Field speed:Float 'Field speedy:Float Field winkel:Float Field tarx:Float Field tary:Float Field r:Byte,g:Byte,b:Byte End Type Viel Spaß |
||
Ich wars nicht. |
![]() |
Best-Möchtegern |
![]() Antworten mit Zitat ![]() |
---|---|---|
Ganz ehrlich....hab schon bessere gesehen. Is aber auch nicht verwunderlich, gibt ja so viele. Jeder Depp macht ein Feuerwerk. Ich hab schon 3 oder 4 ![]() |
||
![]() |
BlitzcoderNewsposter |
![]() Antworten mit Zitat ![]() |
---|---|---|
Nett, aber die Raketengrafik...naja.
Übrigends braucht jeder die EXE, oder haben alle die Grafiken? |
||
P4 3 Ghz@3,55Ghz|GF 6600GT 256MB|Samsung 80GB | 2x Samsung 160GB|2048MB DDR-400 RAM|6 Mbit Flatrate | Logitech G15 | Samsung 225BW-TFT | Ubuntu Gutsy Linux | Windows Vista | Desktop | Blog | CollIDE | Worklog
________________ |°°°°°°°°°°°°°°||'""|""\__,_ |______________ ||__ |__|__ |) |(@) |(@)"""**|(@)(@)****|(@) |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group