Animated Rain
Author |
Message |
Krocker
|
Posted: Mon Nov 08, 2010 11:51 am Post subject: Animated Rain |
|
|
Hiya, can some one help me make an animated rain in my landscape program. I need the rain fall onto the ground and it to be continues. the following is my code for the landscape:
% Landscape design
setscreen ("graphics:max;max,nobuttonbar")
% Creates the sky
drawfillbox (0, 0, 1010, 700, black)
% Draws the Grass
drawfillbox (0, 0, 1010, 180, green)
% Draws the moon
drawfilloval (200, 550, 60, 60, white)
drawfilloval (235, 570, 60, 60, black) % <=Black oval to give the moon a curve shape
% Creates the clouds
drawfilloval (200, 450, 95, 48, 24) % <= Clouds infront of the moon
drawfilloval (150, 460, 100, 50, 24)
drawfilloval (250, 450, 95, 48, 24)
drawfilloval (290, 460, 100, 45, 24)
drawfilloval (600, 500, 95, 48, 24) % <= Clouds behind the building
drawfilloval (640, 480, 100, 50, 24)
drawfilloval (685, 500, 95, 48, 24)
drawfilloval (255, 470, 100, 45, 24)
drawfilloval (980, 510, 95, 48, 24) % <= Clouds right of the building
drawfilloval (1020, 490, 100, 50, 24)
drawfilloval (1020, 530, 100, 50, 24)
% Creates a white screen on the far left to cover 1/2 of the clouds
drawfillbox (1300, 0, 1010, 900, white)
% Create the Apartment
drawfillbox (620, 180, 840, 500, grey)
% Creates the Windows
drawfillbox (650, 470, 690, 420, yellow)
drawfillbox (710, 470, 750, 420, black)
drawfillbox (770, 470, 810, 420, black) % <= 4th story windows
drawfillbox (650, 400, 690, 350, black)
drawfillbox (710, 400, 750, 350, yellow)
drawfillbox (770, 400, 810, 350, black) % <= 3rd story windows
drawfillbox (650, 330, 690, 280, yellow)
drawfillbox (710, 330, 750, 280, yellow)
drawfillbox (770, 330, 810, 280, black) % <= 2nd story windows
drawfillbox (650, 230, 690, 190, yellow) % <= 1st story windows
% Creates a door
drawfillbox (710, 245, 810, 180, white)
drawfillbox (710, 245, 712, 180, brown) % <= Door framing
drawfillbox (810, 245, 808, 180, brown)
drawfillbox (710, 245, 810, 243, brown)
drawfillbox (760, 242, 760, 180, black) % <= Door separation
drawfilloval (750, 208, 2, 2, black) % <= left door knob
drawfilloval (770, 208, 2, 2, black) % <= right door knob
% Creates the chimney
drawfillbox (630, 500, 650, 512, 29) % <= Creates the base if the chimney
drawline (620, 500, 840, 500, 26) % <= Creates a line at the base to separate the apartment and the chimney
drawfilloval (640, 512, 15, 3, 29)
drawoval (640, 512, 15, 3, 28)
% Creates the tree trunk
drawfillbox (200, 180, 215, 300, brown)
% Creates the leafs of the tree
drawfilloval (210, 310, 65, 50, green)
drawfilloval (220, 310, 65, 50, green)
drawfilloval (190, 310, 65, 50, green)
% draws the indoor parkinglot
drawfillbox (410, 180, 610, 300, 15) % <= building structure
drawfillbox (430, 275, 590, 295, black) % <= Layers starting from top
drawfillbox (430, 245, 590, 270, black)
drawfillbox (430, 215, 590, 240, black)
drawfillbox (480, 185, 590, 210, black)
drawfillbox (430, 180, 475, 210, black) % <= Creates the garage's door
drawfillbox (469, 180, 472, 190, 15) % <= Creates the gate mechanism for the entrance
drawfillbox (445, 186, 469, 184, yellow) % <= Creates the gate lever for the entrance
% Creates stars in the sky
drawfillstar (250, 600, 255, 605, white)
drawfillstar (400, 400, 405, 405, white)
drawfillstar (605, 600, 610, 605, white)
drawfillstar (470, 350, 475, 355, white)
drawfillstar (970, 220, 975, 225, white)
drawfillstar (950, 300, 955, 305, white)
drawfillstar (130, 240, 135, 245, white)
drawfillstar (80, 650, 85, 655, white)
drawfillstar (425, 550, 430, 555, white)
drawfillstar (900, 600, 905, 605, white)
drawfillstar (60, 360, 65, 365, white)
drawfillstar (80, 650, 85, 655, white)
drawfillstar (310, 290, 315, 295, white)
drawfillstar (900, 400, 905, 405, white)
drawfillstar (720, 620, 725, 625, white)
drawfillstar (400, 640, 405, 645, white)
drawfillstar (555, 420, 550, 425, white) |
|
|
|
|
|
Sponsor Sponsor
|
|
|
lordroba
|
Posted: Thu Nov 11, 2010 10:00 pm Post subject: Re: Animated Rain |
|
|
If you use the search function in the forums, you can find plenty of examples of rain coded in Turing.
here's one that I like by MihaiG. It's fairly easy to use and looks pretty neat with a nice background.
Turing: |
%by MihaiG
View.Set ("offscreenonly")
var n : int
n := 100
var xg, yg, l : array 1 .. n of int
for i : 1 .. n
randint (l (i ), 1, 3)
randint (xg (i ), - 150, maxx)
randint (yg (i ), l (i ) - 9, maxy)
end for
colorback (black)
cls
procedure rain
for i : 1 .. n
if yg (i ) < maxy - l (i ) then
drawline (xg (i ), yg (i ), xg (i ), yg (i ) - l (i ), white)
else
drawline (xg (i ), maxy, xg (i ), yg (i ), white)
end if
if yg (i ) <= l (i ) then
randint (xg (i ), - 150, maxx)
yg (i ) := maxy
else
yg (i ) := yg (i ) - l (i ) - 9
xg (i ) := xg (i ) + 3
end if
drawline (xg (i ), yg (i ) + l (i ), xg (i ), yg (i ), brightblue)
end for
View.Update
cls
delay (50)
end rain
loop
rain
end loop
| [/code] |
|
|
|
|
|
|
|