View Full Version: Flash rain effect

lassie >>Seeking Talent >>Flash rain effect


<< Prev | Next >>

NigeC- 02-20-2008
Flash rain effect
i'm looking for a rain effect for a game.. most of the ones i've found were done with mx and dont work with a flash 8 movie i have a snow one also done in mx the code looks like this.. what would i need todo to get it to work in flash 8 ? onClipEvent (load) { //variables width = 800; height = 600; //random x,y, and alpha this._xscale = this._yscale=50+Math.random()*100; this._alpha = 20+Math.random()*50; //random x and y for flakes this._x = -width+Math.random()*(3*width); this._y = -10+Math.random()*height; //speed and trigonometric value i = 1+Math.random()*50; k = -Math.PI+Math.random()*Math.PI; rad = 0; } onClipEvent (enterFrame) { // vertical movement this._y += i; // remove clips when they misbehave (overstep boundaries) if (this._x>(width+50)) { this._x = -45; this._y = Math.random()*height*2; } if (this._x<-50) { this._x = width+45; this._y = Math.random()*height*2; } if (this._y>=height) { this._y = -50; this._x = -width+Math.random()*(3*width); } } in the snow flake frame it has snowflakes = 75; do { duplicateMovieClip(snow, "snow"+k, k); k++; } while (k != snowflakes); thanks

bigmac- 02-20-2008

Hmm. AS2 code should port seamlessly between Flash MX 2004 and Flash 8. Regardless, that looks like a pretty bizarre implementation... of course, I'm inherently biased against onClipEvents which are an AS1 carryover that should have stopped being supported in about Flash 4. Can you post a SWF demonstrating what this looks like in execution?

NigeC- 02-20-2008

The fLA is here: http://nigecstudios.co.uk/games/snow_final_2004.zip to see it in action lol: http://nigecstudios.co.uk/games/tptb/ Its been altered to look more like rain.. there's annoying slow drops. the scene has flash buttons with alpha set at "0" at the left and right edges to turn to the next view..forward takes you to a different swf.. sorry it might be slow to load.. the images where a tad large :oops: I had to publish it as a player 6, with the effect.. if i try to run it 7 or 8 i get a warning the script will slow down my system Most of the effects i've found where done for flash mx or older the scene is draft version of a planned game and is just to get a good control system in place.. the intention was cubic rooms, like in Scratches, but the only Flash ones i could find were basicly for virtual tours i'm not clever enough to do my own theres a very good one here: http://cubicvr.popforge.de/#download which is very close to how LUA Pipmak and SCream engines look It seems to use FLEX to compile it, but i don't have it or have a clue how to do it lol

bigmac- 02-20-2008

Tell you what Nige... I think I may have an idea for making a 360-degree room in Lassie that wouldn't involve tiling two instance of the room layout (which I want to avoid). If you make the two ends line up, you can just cut the scene back to the opposite end and have all the graphics line up despite the jump... I suspect that was how all the old SCUMM games did it. I'll make sure to add some kind of scroll override support into SuperSheep.

NigeC- 02-21-2008

it would be a cool feature. it tends to look better in 2D rooms. most of the software i have does true panaramic for 3D so it mght look kinda odd

bigmac- 02-21-2008

Cool effect, BTW. The snow is a nice visual. There's not much to that either, you can easily reproduce something like that. In a nut shell, it's doing this: - create X instances of the particle. - randomize each particle's scale and alpha - On each enter frame, increment particle downward (y+=1) - On each enter frame, increment particle's x position (which in the example is tied to the mouse) - If a particle goes off screen, re-randomize it and place it at the top of the screen for a new fall cycle. Hope that helps.

bigmac- 02-21-2008

You know what Nige... I keep looking at this and am incredibly inspired. This looks beautiful and is –technically– really simple. This really is something that Lassie could have built in. Keep your eyes open for more examples like this. If you see any good particle systems – rain, etc – send them my way.

SeanCyrusTowel- 02-21-2008

What about making the code so that some of the drops of water land on the screen, do a slight drop effect, then fade away (or even drip vertically down the screen? No-Flash-Programming-Wes thinks it wouldn't be that much different than the one now. just add a randomization element to what drops hit the screen.... possible the larger ones?

NigeC- 02-21-2008

There was one that had rain as if it was hitting the screen.. but i binned it lol I did the room turning first and rain was an after thought, when i tried to combine the rain i was running into problems with version conflicts.. i'll do it the other way round and see if i can come up with some more examples

Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.