Help with Rain
- XDuradinX
-
XDuradinX
- Member since: Oct. 4, 2008
- Offline.
-
- Forum Stats
- Member
- Level 08
- Blank Slate
Heya, in the flash movie I'm making I need to have rain. Obviously having lines drop down frame by frame is just going to be a huge waste of time and increase the size of the movie a lot, so I'm wondering if anyone can help me with this. If your suggestion includes actionscript, then please put down the code.
Yeah... that's my sig :)
- JoeyCentral
-
JoeyCentral
- Member since: Oct. 29, 2008
- Offline.
-
- Forum Stats
- Member
- Level 07
- Blank Slate
- XDuradinX
-
XDuradinX
- Member since: Oct. 4, 2008
- Offline.
-
- Forum Stats
- Member
- Level 08
- Blank Slate
At 3/30/09 04:51 PM, JoeyCentral wrote: Chocolate rain anyone?
Don't just write spam to increase your post count >.<
Yeah... that's my sig :)
- Denvish
-
Denvish
- Member since: Apr. 25, 2003
- Offline.
-
- Send Private Message
- Browse All Posts (15,977)
- Block
-
- Forum Stats
- Member
- Level 46
- Blank Slate
- XDuradinX
-
XDuradinX
- Member since: Oct. 4, 2008
- Offline.
-
- Forum Stats
- Member
- Level 08
- Blank Slate
That tut didn't really work lol, but I found another.
This is the code
_root.createEmptyMovieClip("raindrop", 1);
width = Stage.width*2.5;
with (raindrop) {
lineStyle(1, 0x0099FF, 100);
lineTo(2, 7);
}
for (i=0; i<200; i++) {
duplicateMovieClip(raindrop, "rd"+i, 10+i);
_root["rd"+i]._x = random(Stage.width);
_root["rd"+i]._y = random(Stage.height);
_root["rd"+i].speed = random(30)+10;
_root["rd"+i]._alpha = random(80)+20
}
onEnterFrame = function () {
for (i=0; i<200; i++) {
_root["rd"+i]._y += _root["rd"+i].speed;
_root["rd"+i]._x += _root["rd"+i].speed/3;
if (_root["rd"+i]._x>Stage.width) {
_root["rd"+i]._x = random(width)-Stage.width/2;
_root["rd"+i]._y = 0;
}
if (_root["rd"+i]._y>Stage.height) {
_root["rd"+i]._y = 2;
_root["rd"+i]._x = random(width)-Stage.width/2;
}
}
};
Any programmers know how to change it so that the rain falls diagonally to the left instead of diagonally to the right?
Yeah... that's my sig :)
- fjgamer
-
fjgamer
- Member since: Aug. 15, 2008
- Offline.
-
- Forum Stats
- Member
- Level 08
- Blank Slate
At 3/30/09 07:10 PM, XDuradinX wrote: Any programmers know how to change it so that the rain falls diagonally to the left instead of diagonally to the right?
This is super easy code, dude. You should be able to do this without help.
Notice this line of code:
_root["rd"+i]._x += _root["rd"+i].speed/3;
Change it to
_root["rd"+i]._x -= _root["rd"+i].speed/3;
Tada.
- flaminggranny
-
flaminggranny
- Member since: Sep. 12, 2008
- Offline.
-
- Forum Stats
- Member
- Level 10
- Blank Slate
In most tile based games, rain is just a transparent, animated tile that's repeatable. If you create a tileable rain animation, you'll save time and system memory.
- XDuradinX
-
XDuradinX
- Member since: Oct. 4, 2008
- Offline.
-
- Forum Stats
- Member
- Level 08
- Blank Slate
Fjgamer, I tried changing that, but it seems to have done nothing unfortunately :(.
Flaminggranny, so do you mean that I could just make a small 'tile' movie clip and then place it all over the stage to show the rain?
Yeah... that's my sig :)
- Shinki
-
Shinki
- Member since: Feb. 14, 2005
- Offline.
-
- Forum Stats
- Member
- Level 10
- Blank Slate
At 3/30/09 07:54 PM, XDuradinX wrote: Fjgamer, I tried changing that, but it seems to have done nothing unfortunately :(.
His suggestion was correct, it makes the drops move the opposite way, however they are still drawn the wrong way.
Change:
lineTo(2,7);
to:
lineTo(-2,7); - XDuradinX
-
XDuradinX
- Member since: Oct. 4, 2008
- Offline.
-
- Forum Stats
- Member
- Level 08
- Blank Slate
Oh ok I see. Thanks a ton for this all of you and sorry that I don't know a thing about actionscript... good thing is, I'm learning.
Yeah... that's my sig :)
- fluffkomix
-
fluffkomix
- Member since: May. 5, 2008
- Offline.
-
- Forum Stats
- Member
- Level 11
- Animator
sorry cuz i'm an extreme AS noob but how do i make the rain stop?
also how do i change the color?
i can see clearly now the rain is gone
Sig made by me
Once again i'm falling down a mountain like a metaphor
Here ends another post by the grand master of all things: fluffkomix
- Shinki
-
Shinki
- Member since: Feb. 14, 2005
- Offline.
-
- Forum Stats
- Member
- Level 10
- Blank Slate
At 3/30/09 09:02 PM, fluffkomix wrote: sorry cuz i'm an extreme AS noob but how do i make the rain stop?
Use removeMovieClip() on all of the rain particles.
also how do i change the color?
At the top inside the lineStyle() is where the colour is. (It's in hexadecimal ie: 0xFFFFFF).
- zuperxtreme
-
zuperxtreme
- Member since: Jan. 2, 2005
- Offline.
-
- Forum Stats
- Member
- Level 08
- Blank Slate
At 3/30/09 04:51 PM, JoeyCentral wrote: Chocolate rain anyone?
You gotta step away to breathe, man. lol.
- fluffkomix
-
fluffkomix
- Member since: May. 5, 2008
- Offline.
-
- Forum Stats
- Member
- Level 11
- Animator
At 3/30/09 09:08 PM, Shinki wrote: Use removeMovieClip() on all of the rain particles.
well i've been fiddling around with it and i can't seem to get it. what do you mean by that?
Sig made by me
Once again i'm falling down a mountain like a metaphor
Here ends another post by the grand master of all things: fluffkomix
- Denvish
-
Denvish
- Member since: Apr. 25, 2003
- Offline.
-
- Send Private Message
- Browse All Posts (15,977)
- Block
-
- Forum Stats
- Member
- Level 46
- Blank Slate
At 3/30/09 09:18 PM, fluffkomix wrote:At 3/30/09 09:08 PM, Shinki wrote: Use removeMovieClip() on all of the rain particles.well i've been fiddling around with it and i can't seem to get it. what do you mean by that?
for(var i in _root){
if(_root[i]._name.substr(0,2)=="rd"){
_root[i].removeMovieClip();
}
} - flaminggranny
-
flaminggranny
- Member since: Sep. 12, 2008
- Offline.
-
- Forum Stats
- Member
- Level 10
- Blank Slate
At 3/30/09 07:54 PM, XDuradinX wrote: Flaminggranny, so do you mean that I could just make a small 'tile' movie clip and then place it all over the stage to show the rain?
Yeah, that's how most 2D console games do it. You could use a little actionscript to fill a movie clip with the tile, then place that clip on the stage.
- fjgamer
-
fjgamer
- Member since: Aug. 15, 2008
- Offline.
-
- Forum Stats
- Member
- Level 08
- Blank Slate
At 3/31/09 11:37 AM, flaminggranny wrote:At 3/30/09 07:54 PM, XDuradinX wrote: Flaminggranny, so do you mean that I could just make a small 'tile' movie clip and then place it all over the stage to show the rain?Yeah, that's how most 2D console games do it. You could use a little actionscript to fill a movie clip with the tile, then place that clip on the stage.
I think this is how the rain effect was made in Zelda 3: A Link to the Past.
Been a while since I played it, though. Were the cloud shadows tile overlaps, too? I actually think those were large single images overlaying the tiles.



