Gamestudio Links
Zorro Links
Newest Posts
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, juanex), 1,247 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19056 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Rain effect #59421
11/21/05 02:33
11/21/05 02:33
Joined: Jan 2003
Posts: 1,738
Nashua New Hampshire
anonymous_alcoho Offline OP
Senior Developer
anonymous_alcoho  Offline OP
Senior Developer

Joined: Jan 2003
Posts: 1,738
Nashua New Hampshire
I made a quick rain effect. I decided to post the code here.

Code:

var droplets;
string raindropBMP = <raindrop.bmp>;

action rain
{
my.passable = on;
my.transparent = on;
my.alpha = 25;
while(my.z > 0)
{
my.z -= 20 * time;
wait(1);
}
droplets -= 1;
ent_remove(me);
}

function raindrop()
{
var rainVec[3];
while(!player) { wait(1); }
while((player) && (droplets < 400))
{
randomize();
rainVec.x = player.x + random(800) - 400;
rainVec.y = player.y + random(800) - 400;
rainVec.z = player.z + 200;
ent_create(raindropBMP,rainVec,rain);
droplets += 1;
wait(1);
}
}

All you need to do is put this in the script somewhere. The player entity must be followed by the camera in order for this to work properly. I think the nexus might have to be increased (or decrease droplets). And the player pointer has to be replaced by what ever pointer is used by your player.
raindrop(); is called in main()

Enjoy. I'll want credit, but its free for you, commercial or not

Oh, it looks better in run time than in the screenshot

Last edited by anonymous_alcoho; 11/21/05 03:39.

"Oh no, it's true! I'm a love magnet!" Calvin from Calvin and Hobbes My name's Anonymous_Alcoholic.
Re: Rain effect [Re: anonymous_alcoho] #59422
11/21/05 06:28
11/21/05 06:28
Joined: Aug 2005
Posts: 682
Torrance, California
Kerkelenz Offline
Developer
Kerkelenz  Offline
Developer

Joined: Aug 2005
Posts: 682
Torrance, California
there is not much of the actual effect in the screenshot, but its nice. U should still update the screenshot ^^

XTREME

Re: Rain effect [Re: Kerkelenz] #59423
11/21/05 22:21
11/21/05 22:21
Joined: Aug 2005
Posts: 1,185
Ukraine
Lion_Ts Offline
Serious User
Lion_Ts  Offline
Serious User

Joined: Aug 2005
Posts: 1,185
Ukraine
Thank you, Alco!
I'm using similar code for rain, this is cut from it:
(you have to edit this before using, I cut it unchanged from my proj.)
Code:

...
bmap rain_mist_pic = <smoke.tga>;
function rain_mist_()
{
my.alpha -= 5 * time;
if(my.alpha < 0)
{
my.lifespan = 0;
return;
}
my.size += 2*time;//*0.5
}
function rain_mist()
{
temp.x = random(2) - 1;
temp.y = random(2) - 1;
temp.z = random(0.5) + 0.5; // play with this value
vec_set(my.vel_x,temp);
my.bmap = rain_mist_pic;
my.size = 5+random(5);//5
my.flare = on;
my.bright = on;
my.move = on;
my.gravity = 0;
my.alpha = 70;//70
my.function = rain_mist_;
}

bmap raindrop = <drop5.tga>;

//RAIN effect function
Function eff_rain_()
{
if(content(my.x) == content_solid) // the particle is inside a solid?
{
effect(rain_mist, 1, my.x, nullvector); // generate mist
// generate mist
my.lifespan = 0; // don't allow the particles to continue their movement if they have hit something solid
return;
}
my.skill_b += 0.06;//0.03
my.skill_a = 1 - my.skill_b;//6
if(my.skill_a < 0) {
my.lifespan = 0;
}
}

Function eff_rain()
{
if(my.skill_a < 0) { my.skill_a = 0; my.skill_b = 0; }
my.bmap = raindrop;
my.vel_x = random( 10 )-5;
my.vel_y = random( 10 )-5;
my.vel_z = -40 ;
my.size =14 ;
my.move =1 ;
my.alpha = 100 ;
my.x += random(CELL_SIZE * 16)-CELL_SIZE * 8;
my.y += random(CELL_SIZE * 16)-CELL_SIZE * 8;
my.z += random(CELL_SIZE * 2)-CELL_SIZE;
my.transparent = on ;
my.gravity =0 ;
my.bright =on;
my.function = eff_rain_;
my.flare =1 ;
}
...
...
var myPos[3];
while(1) {
while(RAIN_NEEDED==on)&&(MAP_VIEW_ACTIVE==off) {
vec_set(myPOS,camera.x);
temp.x = COS(camera.pan);
temp.y = SIN(camera.pan);
temp.Z = 600*COS(camera.tilt);
MyPos.X = myPos.X + temp.Z*temp.X;
MyPos.Y = myPos.Y + temp.Z*temp.Y;;
// MyPos.Z = myPos.Z + 600*SIN(camera.TILT);
MyPos.Z = Camera.Z + 100;//800;200
effect(eff_rain,50 ,MyPOS,nullvector);
if (moon.alpha > 50) { moon.alpha-=time; }
moon.alpha = max(moon.alpha,0);
if (moon_flare.alpha > 50) { moon_flare.alpha-=time; }
moon_flare.alpha = max(moon_flare.alpha,0);
wait(1);
}
...




Moderated by  adoado, checkbutton, mk_1, Perro 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1