;random number generator by El_Choni
Global result.l
max.l
seed.l ;= 5555 0
End
EndIf
Delay(20+MyRandom(100))
Gosub MakeFlames
If EventID=#PB_EventGadget
GI=EventGadgetID()
If GI =0
Quit=1
EndIf
EndIf
If EventID = #PB_EventRepaint ; If the user has resized the window or anything, we will repaint our graphic
;Gosub SomeGraphics
;Gosub MakeFlames
EndIf
If EventID = #PB_EventCloseWindow ; If the user has pressed on the close button
Quit = 1
EndIf
Until Quit = 1
EndIf
End ; All the opened windows are closed automatically by PureBasic
MakeFlames:
StartDrawing(WindowOutput())
For Y = 50 To 4 Step -1
For X = 0 To 50
;set the random degree of cooldown
FlameArray(X, Y) = FlameArray(X, Y) - MyRandom(* 3)
;set a new random number For the movement
temp2 = MyRandom(* 3)
;move the pixel in the array
FlameArray(X, Y - temp2) = FlameArray(X, Y)
;get the color based on the "heat" value
Color = FlameArray(X, Y) * temp
R1=2*Color
If R1>255
R1=255
EndIf
If R1255
G1=255
EndIf
If G1<0
G1=0
EndIf
B1=20
FrontColour(R1,G1,B1)
Plot (X,Y)
Next X
Next Y
StopDrawing()
;make the bottom 4 rows hot again
For X = 0 To 50
For Y = 46 To 50
FlameArray(X, Y-4) = 50
Next Y
Next X
Return
Getting better with a little help from my friends....thx Siggi
Restored from previous forum. Originally posted by MrVainSCL.
Mhhhh... nice but little small example... Seems it works only correct, when the debugger is enabled... If debuffer is disabled, there will nothing happen... (it will not change the gfx) ...
Restored from previous forum. Originally posted by Rings.
Mhhhh... nice but little small example... Seems it works only correct, when the debugger is enabled... If debuffer is disabled, there will nothing happen... (it will not change the gfx) ...