Be a Supporter!

Help with Rain

  • 375 Views
  • 16 Replies
New Topic Respond to this Topic
XDuradinX
XDuradinX
  • Member since: Oct. 4, 2008
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Help with Rain 2009-03-30 16:24:37 Reply

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 :)

BBS Signature
JoeyCentral
JoeyCentral
  • Member since: Oct. 29, 2008
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
Response to Help with Rain 2009-03-30 16:51:57 Reply

Chocolate rain anyone?


BBS Signature
XDuradinX
XDuradinX
  • Member since: Oct. 4, 2008
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to Help with Rain 2009-03-30 17:58:30 Reply

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 :)

BBS Signature
Denvish
Denvish
  • Member since: Apr. 25, 2003
  • Offline.
Forum Stats
Member
Level 46
Blank Slate
Response to Help with Rain 2009-03-30 18:22:25 Reply

AS: Rain Effect (API) by Inglor


- - Flash - Music - Images - -

BBS Signature
XDuradinX
XDuradinX
  • Member since: Oct. 4, 2008
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to Help with Rain 2009-03-30 19:10:48 Reply

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 :)

BBS Signature
fjgamer
fjgamer
  • Member since: Aug. 15, 2008
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to Help with Rain 2009-03-30 19:37:18 Reply

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
Response to Help with Rain 2009-03-30 19:40:23 Reply

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.


BBS Signature
XDuradinX
XDuradinX
  • Member since: Oct. 4, 2008
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to Help with Rain 2009-03-30 19:54:49 Reply

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 :)

BBS Signature
Shinki
Shinki
  • Member since: Feb. 14, 2005
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to Help with Rain 2009-03-30 19:59:29 Reply

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);

SCGMD4 is on the way! @scgmd4
If a picture is worth a thousand words, a game is worth a play.

BBS Signature
XDuradinX
XDuradinX
  • Member since: Oct. 4, 2008
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to Help with Rain 2009-03-30 20:03:09 Reply

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 :)

BBS Signature
fluffkomix
fluffkomix
  • Member since: May. 5, 2008
  • Offline.
Forum Stats
Member
Level 11
Animator
Response to Help with Rain 2009-03-30 21:02:17 Reply

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

BBS Signature
Shinki
Shinki
  • Member since: Feb. 14, 2005
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to Help with Rain 2009-03-30 21:08:59 Reply

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).


SCGMD4 is on the way! @scgmd4
If a picture is worth a thousand words, a game is worth a play.

BBS Signature
zuperxtreme
zuperxtreme
  • Member since: Jan. 2, 2005
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to Help with Rain 2009-03-30 21:11:52 Reply

At 3/30/09 04:51 PM, JoeyCentral wrote: Chocolate rain anyone?

You gotta step away to breathe, man. lol.


BBS Signature
fluffkomix
fluffkomix
  • Member since: May. 5, 2008
  • Offline.
Forum Stats
Member
Level 11
Animator
Response to Help with Rain 2009-03-30 21:18:45 Reply

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

BBS Signature
Denvish
Denvish
  • Member since: Apr. 25, 2003
  • Offline.
Forum Stats
Member
Level 46
Blank Slate
Response to Help with Rain 2009-03-31 06:06:08 Reply

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();
	}
}

- - Flash - Music - Images - -

BBS Signature
flaminggranny
flaminggranny
  • Member since: Sep. 12, 2008
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to Help with Rain 2009-03-31 11:37:59 Reply

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.


BBS Signature
fjgamer
fjgamer
  • Member since: Aug. 15, 2008
  • Offline.
Forum Stats
Member
Level 08
Blank Slate
Response to Help with Rain 2009-04-05 18:25:22 Reply

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.