Posted: Mon Nov 29, 2004 6:58 pm Post subject: ::RAIN RENDER::
here is an awesome render of rain i made
code:
var n : int
n := 1000
var x, y, l : array 1 .. n of int
for i : 1 .. n
randint (l (i),1,5)
randint (x (i), 1, maxx - l(i))
randint (y (i), l(i), maxy)
end for
loop
for i : 1 .. n
if y (i) < maxy - l (i) then
drawline (x (i), y (i), x (i), y (i) + l(i) , white)
else
drawline (x (i), maxy, x (i), y (i), white)
end if
if y (i) <= l(i) then
randint (x (i), 1, maxx)
y (i) := maxy
else
y (i) := y (i) - l(i)
end if
drawline (x (i), y (i) + l(i), x (i), y (i), blue)
end for
end loop
please i need the precious bits...
Sponsor Sponsor
cool dude
Posted: Mon Nov 29, 2004 7:04 pm Post subject: (No subject)
we r learning arrays in class right now, and i learned a little from your program even though it doesn't do much. anyways nice try.
p.s. i like your quote
Tony
Posted: Mon Nov 29, 2004 8:15 pm Post subject: (No subject)
the problem is that all raindrops look identical and fall in a plane
for num : 1 .. raincount
rain (num) := Pic.New (100, 65, 115, 79)
xr (num) := Rand.Int (0, maxx)
yr (num) := Rand.Int (0, maxy)
end for
loop
drawfillbox (0, 0, maxx, maxy, black)
for num : 1 .. raincount
Pic.Draw (rain (num), xr (num), yr (num), picMerge)
yr (num) -= speed
xr (num) -= speed
if xr (num) < -10 or yr (num) < -10 then
xr (num) := Rand.Int (0, maxx + 300)
yr (num) := Rand.Int (maxy + 50, maxy + 100)
end if
end for
delay (10)
View.Update
end loop
MihaiG
Posted: Mon Nov 29, 2004 8:31 pm Post subject: (No subject)
well ur runs slow at a high number(500-1000) of drops while mine runs slow after 100,000 so its better for "heavy"rain
-edit-
i like my qoute too
take that tony i fixed ur request of making random lengths check code above
Tony
Posted: Mon Nov 29, 2004 11:14 pm Post subject: (No subject)
still needs some tweaking to do. Some drops are unreasonably slow
you should also make drops to be of different colour and make it a gradient background.. or an image
Posted: Mon Nov 29, 2004 11:24 pm Post subject: (No subject)
Over-complicated? I'm gonna work on water beading of the screen next.
code:
import GUI in "%oot/lib/GUI"
var iWindow : int := Window.Open ("noecho, offscreenonly")
const cDropCount := 100
type point :
record
x : int
y : int
end record
randomize
var iSpeed : int := 10
var aiDrops : array 1 .. cDropCount of point
var iX, iY, iButton : int
procedure DrawDrop (x, y : int)
drawfillbox (x, y, x + 1, y + 5, 77)
drawfillbox (x - 1, y + 1, x + 2, y + 3, 77)
end DrawDrop
mousewhere (iX, iY, iButton)
var iDir : int := iX - maxx div 2
for i : 1 .. cDropCount
if iDir > 0 then
randint (aiDrops (i).x, 1 - abs (iDir), 640)
elsif iDir < 0 then
randint (aiDrops (i).x, 1, 640 + abs (iDir))
else
randint (aiDrops (i).x, 1, 640)
end if
randint (aiDrops (i).y, 480, 480 * 2)
end for
RGB.SetColour (0, 0, 0, 0)
loop
delay (10)
Window.Update (iWindow)
cls
for i : 1 .. cDropCount
if aiDrops (i).y < -5 then
if iDir > 0 then
randint (aiDrops (i).x, 1 - abs (iDir), 640)
elsif iDir < 0 then
randint (aiDrops (i).x, 1, 640 + abs (iDir))
else
randint (aiDrops (i).x, 1, 640)
end if
randint (aiDrops (i).y, 480, 490)
else
mousewhere (iX, iY, iButton)
iDir := iX - maxx div 2
aiDrops (i).x += iDir div 50
aiDrops (i).y -= iSpeed
end if
DrawDrop (aiDrops (i).x, aiDrops (i).y)
end for
exit when buttonmoved ("down")
end loop
Window.Close (iWindow)
zomg
Posted: Tue Nov 30, 2004 10:44 am Post subject: (No subject)
i kinda like the first one it may not look like real rain but for some reason i like the effect:)
Sponsor Sponsor
the_short1
Posted: Wed Dec 01, 2004 4:56 pm Post subject: (No subject)
Rapscallion... u ... ncie stuff.... kidna like the good snowflake ones by mazer and asian...
MihaiG
Posted: Wed Dec 01, 2004 6:49 pm Post subject: (No subject)
code:
var n, font2, clr : int
n := 1000
var x, y, l, cl : array 1 .. n of int
for i : 1 .. n
randint (clr , 1, 255)
end for
font2 := Font.New ("sans serif:20:bold,italic,underline")
assert font2 > 0
Font.Draw ("Are you happy Tony?", 50, 80, font2, clr)
Font.Free (font2)
for i : 1 .. n
randint (cl (i), 1, 255)
randint (l (i), 1, 5)
randint (x (i), 1, maxx - l (i))
randint (y (i), l (i), maxy)
end for
loop
for i : 1 .. n
if y (i) < maxy - l (i) then
drawline (x (i), y (i), x (i), y (i) + l (i), white)
else
drawline (x (i), maxy, x (i), y (i), white)
end if
if y (i) <= l (i) then
randint (x (i), 1, maxx)
y (i) := maxy
else
y (i) := y (i) - 8 %l (i)
end if
drawline (x (i), y (i) + l (i), x (i), y (i), cl (i))
end for
end loop
there you go tony are you happy??? i have fixed ur probs../.. so mayn sleepless nights
Cervantes
Posted: Wed Dec 01, 2004 7:07 pm Post subject: (No subject)
True, it can sometimes rain / snow unusual colours such as pink, but so many different colours of rain at one time? Are you mad?!
Have a bit for creativity and determination.
MihaiG
Posted: Wed Dec 01, 2004 7:29 pm Post subject: (No subject)
yes Geoff but if you read before tony wrote that he wanted different colours and i did that... he also wanted them to be the same speed...i tried making a background colour but it would cause seizures
Tony
Posted: Wed Dec 01, 2004 7:36 pm Post subject: (No subject)
ahh, its acid rain!
try
code:
randint (cl (i), 51, 56)
and place a background colour in there... find a way to not cause seizures
and I think your droplets are falling in same plane again..