Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Falling Snow
Author Message
Turing_Student

Posted: 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 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!

Tony

Posted: 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

Tony's programming blog. DWITE - a programming contest.
Turing_Student

Posted: 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!
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 3 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: