Hey all,
I've been connecting a few rooms together in Buc2 which play at night in the countryside... and, it's raining.
This all looks rather good thanks to the awesome RainSnow plugin. However, on the mapscreen it's suddenly not raining anymore.
I'm looking for a way to make it rain there too. Now, I can use the animated background thingy and have 1x1 pixelated raindrops appear at random on several points of the map, since the rain will fall down flat like this:
(http://www.unosar.com/gk2/scrnshot4.gif)
Now it would be neat if I could randomize it a bit more than the animated background stuff. Plus, it would take up a whole lot of unneeded space just to have a few pixels change.
Can anyone think of an easier way to achieve this effect?
you can use rain drops as object and then use random function in repeaditly execute script (if random number 1 Animate object XX ...) You must add last fram of object animation to be transparent.... if you get my point.
Uhm.. I don't, really.
You mean having each raindrop be an individual object?
Or have it randomly appear on the map at certain times?
You could do something like this for example:
Make a view with each loop containing a different animation of a rain drop falling down, then:
// room script file
#define RAINDROP_AMOUNT 100 // number of rain drops to draw
#define RAINDROP_VIEW 21 // view number containing animation loops
#define RAINDROP_ANIMDELAY_MIN 5 // animation speed will be randomized between these two values
#define RAINDROP_ANIMDELAY_MAX 20
struct RainDrop {
int loop; // stores current loop
int frame; // stores current frame
int framedelay; // stores delay until next frame
int animationdelay; // stores overall animation speed
int x; // stores x-location
int y; // stores y-location
};
RainDrop raindrops[RAINDROP_AMOUNT];
function room_a() {
// script for room: Player enters screen (before fadein)
RawSaveScreen(); // save default (clean) background frame
}
function repeatedly_execute_always() {
RawRestoreScreen(); // restore clean background frame
int dropid = 0; // start with first drop
while (dropid < RAINDROP_AMOUNT) { // loop for each drop
if (raindrops[dropid].framedelay) raindrops[dropid].framedelay--; // if delay until next frame has not elapsed, decrease it
else { // if delay until next frame has elapsed
if (raindrops[dropid].frame >= GetGameParameter(GP_NUMFRAMES, RAINDROP_VIEW, raindrops[dropid].loop, 0)) // if animation has finished
raindrops[dropid].frame = 0; // go to first frame
if (raindrops[dropid].frame == 0) { // if at first frame (new animation)
raindrops[dropid].loop = Random(GetGameParameter(GP_NUMLOOPS, RAINDROP_VIEW, 0, 0) - 1); // randomly select new loop from rain drop view
raindrops[dropid].animationdelay = RAINDROP_ANIMDELAY_MIN + Random(RAINDROP_ANIMDELAY_MAX - RAINDROP_ANIMDELAY_MIN); // randomize overall animation speed
raindrops[dropid].x = Random(game.room_width); // randomize x-location
raindrops[dropid].y = Random(game.room_height); // randomize y-location
}
raindrops[dropid].framedelay = raindrops[dropid].animationdelay + GetGameParameter(GP_FRAMESPEED, RAINDROP_VIEW, raindrops[dropid].loop, raindrops[dropid].frame); // set delay until next frame
raindrops[dropid].frame++; // go to next frame
}
RawDrawImage(raindrops[dropid].x, raindrops[dropid].y, GetGameParameter(GP_FRAMEIMAGE, RAINDROP_VIEW, raindrops[dropid].loop, raindrops[dropid].frame - 1)); // draw rain drop on background
dropid++; // loop to next drop
}
}
Or you could use a single image and automatically draw it resized with RawDrawImageResized. I can whip something up later if you're interested.
It would probably be easiest to not have any random functions. Just draw an object the same size as the room. Then make about 10 frames, each with the droplets in different places. Put the object in the room where it coveres the map, and then animate it. If you wanted more changes, you could just add another frame.
stazer's code ( :o ) would probably look more realistic due to the randomization, seeing as rain is sporadic, and there's not a pattern of only 10 frames repeating themselves...if realism is important...
Quote from: Hobbes on Sat 23/04/2005 19:32:14
Uhm.. I don't, really.
You mean having each raindrop be an individual object?
Or have it randomly appear on the map at certain times?
you must make few object (lets say 12) and set their animation , and the set them equaly trough out the screen.. or you could use strazer idea too ;D
this might eb a dumb question, but, why isn't the Snowrain plugin working? I assume the mapscreen is another room? unless its a gui, in whcih case, i understand.
zooty, snow/rain plugin rain falls down right? Well if you're looking down on a map which way would snow/rain plugin rain fall?
It would look like it's falling horizontally across the earth.
which AGS are you using?
here is an animated GIF that you can import right into the new ags, how does it look?
http://www.sylpher.com/kafka/junk/edits/hobbesrain.gif
eric
Quote from: MrColossal on Sun 24/04/2005 19:36:21
Well if you're looking down on a map which way would snow/rain plugin rain fall?
It would look like it's falling horizontally across the earth.
It should look like dots? Randomly sparkling or something ?
It would look like those starfield screensavers, except going away from you, not coming at you. It should be relatively easy to program.
Quote from: Snarky on Mon 25/04/2005 13:50:25
It would look like those starfield screensavers, except going away from you
You mean like this?
Quote from: MrColossal
http://www.sylpher.com/kafka/junk/edits/hobbesrain.gif
:)
Quote from: MrColossal on Sun 24/04/2005 19:36:21
zooty, snow/rain plugin rain falls down right? Well if you're looking down on a map which way would snow/rain plugin rain fall?
It would look like it's falling horizontally across the earth.
which AGS are you using?
here is an animated GIF that you can import right into the new ags, how does it look?
http://www.sylpher.com/kafka/junk/edits/hobbesrain.gif
eric
Oooh, this looks splendid! I don't have the latest AGS, though, since Buc2 is being developed in 2.62 and I know for sure that Proskrito's template works with that.
But I should be able to extract the seperate screens and use them as sprites, right?
Thanks, anyway. It looks really neat!
I suppose you could do that... Or maybe, when exporting a cha file it saves all the frames and such, I can gif import and export a .cha and give it to you
Eric
I would appreaciate that, as for some reason, I have gone this far without a gif extractor.
You need a top down rain image for a 640x400 game?
If you could do this as a .cha file, that would be fantastic!
However, I forgot to mention that the game is actually 320x200. I only enlarged the gif so it would be clearer.
I hope it's not too much of a hassle?
I'll just make another at that size, no worries
http://sylpher.com/kafka/junk/Rain.zip
try that
Eric, just wanted to say: thank you! I imported the character, set the transparacy value and placed it correctly on the map screen.
It looks wonderful and the transition to normal screens where it's raining looks really nice now.
Thanks again!
Hooray!
Glad to help.