forums

TNT Basic Forums > Programming Q&A
"Weather"
< Last Thread     Next Thread >
Author
Thread        Post A Reply

10-22-2006 20:18

Posted by:
Redd

Location:
uh... *blink*

Click Here to Email Redd   Find more posts by Redd

(This is not the same project I had mentioned before in the other thread)

In the game I'm making, I need to have different locations with different weather and would like to avoid pointless hassles with coding (where possible).

I've noticed that drawing rain/snow manually causes problems to the screen (sometimes I can't remove it, or it doesn't even appear on-screen), so my question is:

Do I have to use sprites to make bad weather? What's the best way to make it work?

10-22-2006 22:51

Posted by:
Jacob

Location:
San Francisco, CA

Click Here to Email Jacob   Find more posts by Jacob

I use this for rain or snow:

int n, rainX[999], rainY[999], rainAmount=100
for n=0 to rainAmount-1
rainX[n]=rainX[n]+2
rainY[n]=rainY[n]+10

if rainY[n]>screenHeight
if random(0, 1)=0
rainX[n]=random(0, screenWidth)
rainY[n]=0
else
rainX[n]=0
rainY[n]=random(0, screenHeight)
end if
end if

sprite n, rainX[n], rainY[n], 0 'your rain image
next

10-23-2006 06:32

Posted by:
Redd

Location:
uh... *blink*

Click Here to Email Redd   Find more posts by Redd

Mhmm...

Ooh, nice one. I wonder why something similar didn't come to mind.

Thanks for the code! It made just life a little easier!

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.