Posted: Tue Sep 13, 2005 1:30 pm Post subject: My rain program
Hi, im back after the summer. sorry about that. anyways this is my first program since i am back in school. if you can in any way shorten it or mod it, id be happy to see your input.
Sponsor Sponsor
MiX-MaztA-M8riX
Posted: Tue Sep 13, 2005 3:23 pm Post subject: (No subject)
Dont have turing at home, but this type of program hasnt been beaten to death yet.. thank god havent seen rain in a while... not too shabby
anywho, at least you used ThickLines thats about all I can say
[Gandalf]
Posted: Tue Sep 13, 2005 3:55 pm Post subject: (No subject)
Good try, but it would be better if the rain actually moved down. Still, this is a pretty simple way and it works.
I recall seeing lots of rain/snow programs before, but it's always nice to have fresh input into something .
Delos
Posted: Tue Sep 13, 2005 7:17 pm Post subject: (No subject)
Tidying up time!
code:
var x1, y1, ... : int
You need arrays!
Turing:
var rainX :array1..6ofint var rainY :array1..6ofint
Or even better yet, records will help you to centralise everything.
function setRain (pX, pY :int): rain
var tempRain : rain
tempRain.x := pX
tempRain.y := pY
result rain
end setRain
loop for i :1..upper(rainArr)
rainArr (i):= setRain (Rand.Int (0, maxx), Rand.Int (0, maxy)) endfor %...
We will take note that this does not actually animate the rain. We simply get lines drawn randomly on the screen.
To achieve said effect, simply set up the rain array initially, then change the x- and y- values as necassary. This will then form a very primitive particle engine.
Note that with this design, one can also change the 'rain' type to include other properties too. Of course, remember to change the initialization fcns to reflect these changes as well.
ZeroPaladn
Posted: Wed Sep 14, 2005 7:14 am Post subject: (No subject)
thanks for all your help, im currently working on another where the rain moves in a PREDICTABLE path, instead of random lines. this should help me a bit, and im still learing arrays, so i didnt put them in. now i know what to do, and V2 is coming!
codemage
Posted: Tue Sep 20, 2005 1:52 pm Post subject: (No subject)
Possible mods:
*Randomize the thickness of your rain
(Rand.Int(2,4) wood look good with your v.1 settings.)
*Occasional Lightning
*Changing intensity of rain (heavy / light)
ZeroPaladn
Posted: Tue Sep 20, 2005 3:14 pm Post subject: (No subject)
all good ideas, but, alas, im working on a new project (see turing applications). Its a Decimal -> Binary converter. My comp Engineering teacher said i could do it for extra credit... heheh... free marks...
goboenomo
Posted: Thu Oct 13, 2005 11:41 am Post subject: (No subject)
[Gandalf] wrote:
Good try, but it would be better if the rain actually moved down. Still, this is a pretty simple way and it works.
I recall seeing lots of rain/snow programs before, but it's always nice to have fresh input into something .
Rain should have moved down for sure.. and i think it would have looked a bit better it the droplets were more oval shaped.
Sponsor Sponsor
ZeroPaladn
Posted: Fri Oct 14, 2005 8:45 am Post subject: (No subject)
is it even possible to draw ovals on an angle (unless you use Pic.New and Pic.Rotate)
[Gandalf]
Posted: Fri Oct 14, 2005 2:51 pm Post subject: (No subject)
Draw.Arc
...Or else you could just use boxes/lines...
belarussian
Posted: Wed Nov 18, 2009 10:10 am Post subject: Re: My rain program
Ok IF YOU WANT REAL RAIN HERE IT IS
const NoOfrain := 400
var rainX : array 1 .. NoOfrain of int
var rainY : array 1 .. NoOfrain of int
for rain : 1 .. NoOfFlakes
rainX (rain) := Rand.Int (0, maxx)
rainY (rain) := Rand.Int (0, maxy)
end for
for rain : 1 .. NoOfrain
%Drop The rain
rainY (rain) -= Rand.Int (1, 5)
%rainX (rain) += Rand.Int (-1, 1)
if rainY (rain) < 0 then
rainY (rain) := maxy
rainY (rain) := Rand.Int (0, maxx)
end if
Draw.FillOval (rainX (rain), rainY (rain), 1, 1, blue)
end for
%Update the screen (because of offscreen only)
View.Update
delay (25)
Turing_Gamer
Posted: Wed Nov 18, 2009 12:09 pm Post subject: Re: My rain program
belarussian @ Wed Nov 18, 2009 10:10 am wrote:
...
for rain : 1 .. NoOfFlakes
rainX (rain) := Rand.Int (0, maxx)
rainY (rain) := Rand.Int (0, maxy)
end for
...
Do you mean...
for rain : 1 .. NoOfrain
rainX (rain) := Rand.Int (0, maxx)
rainY (rain) := Rand.Int (0, maxy)
end for
belarussian
Posted: Tue Dec 08, 2009 9:18 pm Post subject: RE:My rain program
ya i do mean that yah
belarussian
Posted: Tue Dec 08, 2009 9:23 pm Post subject: RE:My rain program