Gerador de NuvensSistema para gerar nuvens de diferentes tamanhos e formas
(https://i.imgur.com/znMQXEM.png)
Download:https://www.dropbox.com/s/mvaw6f1ydmigm0o/CloudCreator.zip?dl=0
Script:
SetWindowTitle( "Clouds" )
SetVirtualResolution(1920, 1080)
SetWindowSize(960, 540, 0)
SetClearColor(151, 170, 204)
SetSyncRate(60, 1)
SetVSync(1)
SetScissor(0, 0, 0, 0)
UseNewDefaultFonts(1)
SetErrorMode(2)
LoadImage(1, "cloud_1.png")
LoadImage(2, "cloud_2.png")
LoadImage(3, "cloud_3.png")
global spriteID as integer
spriteID = 1000
do
if GetPointerPressed()
cloudCreator(GetPointerX(), GetPointerY())
endif
if GetRawKeyPressed(69) = 1 //E
deleteClouds()
endif
Sync()
loop
/*
Example:
0 1 2 3 4 5 6 7 8
_ _ _ _ _ _ _ _ _
0 0 0 0 0 0 1 0 0| 3
0 0 1 0 0 1 1 1 0| 2
0 0 1 0 0 1 1 1 0| 1
1 1 1 1 1 1 1 1 1| 0
-----------------
1 0 0 0 0 1 0 1 0 - Extra
*/
function cloudCreator(xi as integer, yi as integer)
x = xi : y = yi
#constant CLOUD_height = 3
#constant CLOUD_width = 11
cloudData as integer[CLOUD_height, CLOUD_width]
//Generate cloud values
length = Random2(3, CLOUD_width)
for column = 0 to length
cloudData[0, column] = 1
next column
for column = 0 to CLOUD_width
for line = 1 to CLOUD_height
//if cloudData[line - 1, column] = 0 then exit
cloudData[line, column] = Random2(0, 1)
next line
next column
//Draw Cloud
for line = 0 to CLOUD_height
for column = 0 to CLOUD_width
if cloudData[line, column] = 1
CreateSprite(spriteID, Random2(1, 3))
SetSpriteOffset(spriteID, GetImageWidth(1)/2, GetImageHeight(1)/2)
SetSpritePositionByOffset(spriteID, x, y)
spriteID = spriteID + 1
x = x + random(GetImageWidth(1), GetImageWidth(1)/2)
endif
next column
x = xi
y = y - random(GetImageHeight(1), GetImageHeight(1)/2)
next line
endfunction
function deleteClouds()
for k = 1000 to spriteID
if GetSpriteExists(k) then DeleteSprite(k)
next k
spriteID = 1000
endfunction