Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Falling Snow
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Turing_Student




PostPosted: Tue Dec 03, 2002 11:27 pm   Post subject: Falling Snow

Hey, how are you all doing?
I'm a h/s student and I'm just trying to get thru my computer science class Wink Haha, so for my final project we have to make a computer game and I'm having trouble with making snow fall down my screen. I know it's probably very simple, but I have no clue how to make it work. I know how the Rand.Int function works but is that the way to go? If anyone could help me with this that would be great! Thanks!
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Tue Dec 03, 2002 11:54 pm   Post subject: (No subject)

there're few ways of doing that, it depends on the result you want to achive. The easiest is
code:

proc Snow(amount:int)
for i:1..amount
x:= Rand.Int(1,maxx)
y:= Rand.Int(1,maxy)
drawdot(x,y,white)
end for
end Snow


Here you basically randomly pick location for the snowflake and draw it there. But it will be different every time you do that, since its random.

To make snow actually fall, you'd have to create an array, storing their location and making it "fall" (y:=y-1) each time you go through the loop. As in

code:

for i:1..SnowAmount
snowY(i):= snowY(i) - 1
end for


Good luck on your project Exclamation
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Turing_Student




PostPosted: Tue Dec 03, 2002 11:57 pm   Post subject: Thanks!

Wow, thanks so much! I'll let ya know if I can get it working! Very Happy
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: