i have tried to impliment noise but and move it but it does not seem to have any effect, if you could see what was wrong with my code i would be very gratefull
Graphics 640,480 Global img = CreateImage(100,100) Dim cooling(100,100) For x# = 0 To 1 Step 0.01 For y# = 0 To 1 Step 0.01 cooling(x#*100,y#*100) = PerlinNoise_2D#(x#, y#)/700 Next Next SetBuffer ImageBuffer(img) Color 255,0,0 Rect 50,98,10,2 SetBuffer BackBuffer() frame = 0 While Not KeyDown(1) SetBuffer ImageBuffer(img) Color 255,0,0 Rect 50,98,10,2 SetBuffer BackBuffer() Cls LockBuffer ImageBuffer(img) For x = 2 To 98 For y = 2 To 98 top = ReadPixelFast(x,y-1,ImageBuffer(img)) bot = ReadPixelFast(x,y+1,ImageBuffer(img)) lleft = ReadPixelFast(x+1,y,ImageBuffer(img)) rright = ReadPixelFast(x-1,y,ImageBuffer(img)) If GetRed(top)+GetRed(bot)+GetRed(lleft)+GetRed(rright) > 0 WritePixelFast x,y-1,Combine((GetRed(top)+GetRed(bot)+GetRed(lleft)+GetRed(rright))/4-cooling(x,y),0,0),ImageBuffer(img) EndIf Next Next UnlockBuffer ImageBuffer(img) For x = 0 To 100 For y = 0 To 100 temp1 = cooling(x,y) cooling(x,y) = temp temp = temp1 Next Next cooling(0,0) = cooling(99,99) frame = frame+1 Mod 5 DrawImage img,0,0 Text 10,10,cooling(60,60) Flip Wend Function GetRed(col) Return (col Shr 16) And $FF End Function Function GetGreen(col) Return (col Shr 8) And $FF End Function Function GetBlue(col) Return col And $FF End Function Function Combine(r,g,b) Return (b Or (g Shl 8) Or (r Shl 16) Or (255 Shl 24)) End Function Function Noise#(x, y) n = x + y * 57 SeedRnd n Return Rand(255) End Function Function tNoise#(x, y) n = x + y * 57 n = (n And 13) ^ n; Return ( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) ) / 1073741824.0) End Function Function SmoothNoise_1#(x#, y#) corners# = ( Noise(x#-1, y#-1)+Noise(x#+1, y#-1)+Noise(x#-1, y#+1)+Noise(x#+1, y#+1) ) / 16 sides# = ( Noise(x#-1, y#) +Noise(x#+1, y#) +Noise(x#, y#-1) +Noise(x#, y#+1) ) / 8 center # = Noise(x#, y#) / 4 Return corners# + sides# + center# End Function Function Interpolate2D#(x#, y#) integer_X = Int(x) fractional_X# = x# - integer_X integer_Y = Int(y) fractional_Y# = y# - integer_Y v1# =SmoothNoise_1#(integer_X, integer_Y) v2# = SmoothNoise_1#(integer_X + 1, integer_Y) v3# = SmoothNoise_1#(integer_X, integer_Y + 1) v4# =SmoothNoise_1#(integer_X + 1, integer_Y + 1) i1# = Interpolate(v1# , v2 #, fractional_X#) i2# = Interpolate(v3# , v4 #, fractional_X#) Return Interpolate#(i1# , i2# , fractional_Y#) End Function Function PerlinNoise_2D#(x#, y#) total# = 0 p# = 10 n #= 10 - 1 For i = 0 To n frequency #= 2*i amplitude# = Pi total #= total# + Interpolate2D#(x# * frequency#, y# * frequency#) * amplitude# Next Return total# End Function Function Interpolate#(a,b,x#) ft# = x#*Pi f# = (1-Cos(ft#))*0.5 Return a*(1-x)+b*f# End Function