hab bisschen damit rumgespielt :
BlitzBasic: [AUSKLAPPEN] [EINKLAPPEN]
Global particle_pic=CreateImage(50,50) SetBuffer ImageBuffer(particle_pic) Color 0,0,255 Oval 0,0,50,50 Color 255,255,255 Oval 20,20,10,10 Color 255,255,0 Line 0,0,50,50 Line 0,50,50,50 Line 50,0,50,50
SaveImage particle_pic,"particle_pic.JPG"
Global leader_pic=CreateImage(50,50) SetBuffer ImageBuffer(leader_pic) Color 0,0,255 Oval 0,0,50,50,1 SaveImage leader_pic,"leader_pic.JPG"
Type particle Field sprite Field health Field red,gre,blu Field typ Field turn# End Type
Dim UDFColor(2) UDFColor(1) = $000000 UDFColor(2) = $FFFFFF
Graphics3D 1024,768,32,1 SetBuffer BackBuffer()
cam = CreateCamera() PositionEntity cam,0,0,-30
Global sprite = LoadSprite("particle_pic.JPG") HideEntity sprite Global leader = LoadSprite("leader_pic.JPG")
Global timer Global KK = CreatePivot() EntityParent leader,KK Global Winkel
Global fps_anzeige Global fps_ms=MilliSecs() Global fps_frames
Repeat
WW = ( WW + 2 ) Mod 360 XX# = Cos(WW)*10 YY# = Sin(WW)*2 PositionEntity KK,XX#,YY#,0
If timer + 25 < MilliSecs() Then add_particle() timer = MilliSecs() EndIf update_particle() RenderWorld() If guiButton("Ende",924,0,100,50)=1 Then DeleteFile "particle_pic.JPG" DeleteFile "leader_pic.JPG" End EndIf DrawPointer(MouseX(),MouseY()) Flip Cls Until KeyHit(1) DeleteFile "particle_pic.JPG" DeleteFile "leader_pic.JPG" End
Function add_particle() particle.particle = New particle particle\sprite = CopyEntity(sprite) particle\health = 100 ShowEntity particle\sprite particle\turn = Rnd(359) particle\typ = Rand(0,5) RotateEntity particle\sprite,Rnd(359),Rnd(180,359),0 PositionEntity particle\sprite, EntityX(KK), EntityY(KK), EntityZ(KK) End Function
Function update_particle() For particle.particle = Each particle If particle\health > 0 Then If particle\typ = 5 MoveEntity particle\sprite,0,0,.1 EndIf particle\turn = particle\turn + 1 RotateSprite particle\sprite,particle\turn particle\health = particle\health - 1 EntityAlpha particle\sprite,particle\health / 100.0 ScaleSprite particle\sprite,particle\health / 100.0,particle\health / 100.0 EntityColor particle\sprite,particle\red,particle\gre,particle\blu particle\red = particle\health*3 particle\gre = particle\health/100.0 particle\blu = 100 EndIf If particle\health = 0 Then FreeEntity particle\sprite Delete particle EndIf Next End Function
Function Fps() fps_frames=fps_frames+1 If MilliSecs()-fps_ms >= 1000 Then fps_anzeige=fps_frames fps_frames=0 fps_ms=MilliSecs() EndIf End Function
Function guiButton(Text$,x,y,w,h) If h < FontHeight() Then h = FontHeight() If w < StringWidth(Text$) Then w = StringWidth(Text$)
Color 255,255,255 If MouseOver(x,y,w,h) And MouseDown(1) Then Color 100,100,100 Rect x,y,w,h,1 Color 100,100,100 If MouseOver(x,y,w,h) And MouseDown(1) Then Color 255,255,255 Rect x+1, y+1, w-1, h-1,1 Color 198,198,198 If MouseOver(x,y,w,h) Then
EndIf Rect x+1, y+1, w-2, h-2,1 Color 0,0,0 Text x + w/2 - (StringWidth(Text$)/2), y + h/2 - (FontHeight()/2), Text$ If MouseOver(x,y,w,h) And MouseDown(1) Then Return 1 EndIf End Function
Function MouseOver(x,y,w,h) If MouseX() > x And MouseX() < x+w And MouseY() > y And MouseY() < y+h Then Return 1 End Function
Function DrawPointer(x,y) LockBuffer() Restore MouseImage Read Width,Height For y1 = 0 To Height-1 LCol = 0 For x1 = 0 To Width-1 Read Col1 If (x+x1)>=0 And (y+y1)>=0 And (x+x1)<GraphicsWidth() And (y+y1)<GraphicsHeight() Then If Col1 Then LCol = 6 Col = UDFColor(Col1) WritePixelFast x+x1,y+y1,Col Else If LCol > 0 Then LCol = LCol - 1 EndIf If (LCol > 0) And (Col1 = 0) Then LCol2 = ReadPixelFast(x+x1,y+y1) R = (LCol2 And $FF0000) / $10000 * ((6-LCol) * 8 + 52) / 100 + 10 G = (LCol2 And $FF00) / $100 * ((6-LCol) * 8 + 52) / 100 + 10 B = (LCol2 And $FF) * ((6-LCol) * 8 + 52) / 100 + 10 WritePixelFast x+x1,y+y1,R * $10000 + G * $100 + B EndIf EndIf Next Next UnlockBuffer() End Function
.MouseImage Data 15,21 Data 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0 Data 1,1,0,0,0,0,0,0,0,0,0,0,0,0,0 Data 1,2,1,0,0,0,0,0,0,0,0,0,0,0,0 Data 1,2,2,1,0,0,0,0,0,0,0,0,0,0,0 Data 1,2,2,2,1,0,0,0,0,0,0,0,0,0,0 Data 1,2,2,2,2,1,0,0,0,0,0,0,0,0,0 Data 1,2,2,2,2,2,1,0,0,0,0,0,0,0,0 Data 1,2,2,2,2,2,2,1,0,0,0,0,0,0,0 Data 1,2,2,2,2,2,2,2,1,0,0,0,0,0,0 Data 1,2,2,2,2,2,2,2,2,1,0,0,0,0,0 Data 1,2,2,2,2,2,2,2,2,2,1,0,0,0,0 Data 1,2,2,2,2,2,2,1,1,1,1,1,0,0,0 Data 1,2,2,2,1,2,2,1,0,0,0,0,0,0,0 Data 1,2,2,1,1,2,2,1,0,0,0,0,0,0,0 Data 1,2,1,0,0,1,2,2,1,0,0,0,0,0,0 Data 1,1,0,0,0,1,2,2,1,0,0,0,0,0,0 Data 1,0,0,0,0,0,1,2,2,1,0,0,0,0,0 Data 0,0,0,0,0,0,1,2,2,1,0,0,0,0,0 Data 0,0,0,0,0,0,0,1,2,2,1,0,0,0,0 Data 0,0,0,0,0,0,0,1,2,2,1,0,0,0,0 Data 0,0,0,0,0,0,0,0,1,1,0,0,0,0,0
|