Gamestudio Links
Zorro Links
Newest Posts
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
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (degenerate_762, AbrahamR, AndrewAMD, ozgur), 667 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Raining inside the houses [Re: Mythran] #171496
12/10/07 16:33
12/10/07 16:33
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
If your geometry is relatively simple, then you can precalculate the drops falltime first, so you won't need to do traces or movement on each drop.

Ask Sp|ke, I don't have the code anymore, but he might...


xXxGuitar511
- Programmer
Re: Raining inside the houses [Re: xXxGuitar511] #171497
12/10/07 23:02
12/10/07 23:02
Joined: Apr 2006
Posts: 58
Moerk Offline
Junior Member
Moerk  Offline
Junior Member

Joined: Apr 2006
Posts: 58
Here is a code i made for you!

Code:

bmap the_rain = "rain.pcx";

function remove_me();
function fall();
function raindrops();



function main
{
level_load("YOURMAP.wmb"); // load your map
wait(3);
raindrops(); // start the weather effect
}

function raindrops()
{
while(1)
{
vec_set(temp, vector(random(1000)-500,random(1000)-500,300)); // Choose your size its in a random area between 1000 and -500 quants. it starts on a high of 300 quants
ent_create("rain.pcx", temp, fall); // create the raindrops
sleep(0.2); // Choose your own speed, you can also use wait
}

}

function fall()
{
my.enable_entity = on; // sensitive for entitys (player)
my.enable_block = on; // sensitive for blocks (level)
my.event = remove_me; // The event who starts when he hit a entity or a block
while(my != 0) // while i´m not removed
{
c_move(my, vector(0,0,-8*time_step), nullvector, 0); //c_move without "glide" you can change the numbers in vector if you want ti drop it more fast and maybe a bit angular
wait(1);
}
}

function remove_me() // the event
{
if(EVENT_TYPE == EVENT_block) // if raindrops hit a wall or a buildung or whatever
{
wait(3); // you can take a higher value if you want your raindrops life longer. better do that if you need snow
ent_remove(my); // remove raindrop
}
if(EVENT_TYPE == EVENT_entity)
{
wait(3);
ent_remove(my);
}
}



You can change your weathereffect if you use variables. For example you can create a variable with the name "rain_amount = 0.2" you can use that in the sleep(rain_amount) in the raindrops function. In another script you can simply change this value and enforce the rainfall or damp it.

Greetings and have fun!


"Die Kette die mich ewig hält möge man erst noch schmieden" Regina S.
Page 2 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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