; **************************************************************************** ; * By PBFrance : http://www.pbfrance.com/?url=source&cmd=viewer&val=78 ; **************************************************************************** ;==================================== ; Fire Effect, flype ;==================================== EnableExplicit #W = 200 #H = 150 #Z = 2 Define x, y, i Dim cmap.l(256) Dim pix.l(#W+2, #H+2) For i = 0 To 31 cmap(i + 0) = RGB( 0, 0, i << 1) cmap(i + 32) = RGB(i << 3, 0, 64 - (i << 1)) cmap(i + 64) = RGB( 255, i << 3, 0) cmap(i + 96) = RGB( 255, 255, i << 2) cmap(i + 128) = RGB( 255, 255, 64 + (i << 2)) cmap(i + 160) = RGB( 255, 255, 128 + (i << 2)) cmap(i + 192) = RGB( 255, 255, 192 + i) cmap(i + 224) = RGB( 255, 255, 224 + i) Next If OpenWindow(0, 0, 0, #W*#Z, #H*#Z, "Fire Effect", #PB_Window_SystemMenu|#PB_Window_ScreenCentered) CanvasGadget(0, 0, 0, #W*#Z, #H*#Z) Repeat pix(Random(#W, 0), #H+2) = Random(255, 0) pix(Random(#W, 0), #H+2) = Random(255, 0) pix(Random(#W, 0), #H+2) = Random(255, 0) For y = 0 To #H + 1 For x = 1 To #W - 1 pix(x, y) = (pix(x-1, y) + pix(x+1, y) + pix(x, y+1) + pix(x, y+1)) >> 2 Next Next StartDrawing(CanvasOutput(0)) For y = 0 To #H - 1 For x = 0 To #W - 1 Box(x*#Z, y*#Z, #Z, #Z, cmap(pix(x, y))) Next Next StopDrawing() Until WaitWindowEvent(1) = #PB_Event_CloseWindow EndIf