2DWorlds Forums
Terrain Color Shifter Script - Printable Version

+- 2DWorlds Forums (http://2dworlds.buildism.net/forum)
+-- Forum: Your Stuff (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=6)
+--- Forum: Free Resources (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=32)
+--- Thread: Terrain Color Shifter Script (/showthread.php?tid=9538)



Terrain Color Shifter Script - Qwertygiy - 06-22-2012

Not a very big or difficult script; I just made this for Script Builder. Basically, it smoothly shifts the color of the game's Terrain randomly.

[lua]
local redamount = 1
local blueamount = 1
local greenamount = 1

while true do
sleep(0.1)
redamount = redamount + math.random(-1, 1)
if redamount > 8 or redamount < -8 or game.Terrain.Color.r + redamount > 255 or game.Terrain.Color.r + redamount < 0 then
redamount = 0
end
blueamount = blueamount + math.random(-1, 1)
if blueamount > 8 or blueamount < -8 or game.Terrain.Color.b + blueamount > 255 or game.Terrain.Color.b + blueamount < 0 then
blueamount = 0
end
greenamount = greenamount + math.random(-1, 1)
if greenamount > 8 or greenamount < -8 or game.Terrain.Color.g + greenamount > 255 or game.Terrain.Color.g + greenamount < 0 then
greenamount = 0
end
game.Terrain.Color = Color(game.Terrain.Color.r + redamount, game.Terrain.Color.g + greenamount, game.Terrain.Color.b + blueamount)
end
[/lua]