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

Username:   Password: 
 RegisterRegister   
 Don't Understand the SnowFall Program!! heLP! plz?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
pink00rock




PostPosted: Wed Feb 25, 2004 1:02 am   Post subject: Don't Understand the SnowFall Program!! heLP! plz?

Hey there, This code was submitted by AsianSensation. I don't want to steal it or anything, but i want to make a program that is similar to it. The only problem is that i don't understand the program.. can someone explain it to me please?
thank you so much .
- sunny.

code:


View.Set ("offscreenonly")
colorback (blue)
cls

type SnowType :
    record
        X, Y, Spd, Size : int
    end record

var Snow : array 1 .. 100 of SnowType

for rep : 1 .. 100
    Snow (rep).X := Rand.Int (5, 645)
    Snow (rep).Y := Rand.Int (5, 475)
    Snow (rep).Spd := Rand.Int (1, 3)
    Snow (rep).Size := Snow (rep).Spd
end for

loop
    for rep : 1 .. 100
        Snow (rep).Y -= Snow (rep).Spd
        if Snow (rep).Y < Snow (rep).Size then
            Snow (rep).Y := Rand.Int (475, 575)
        end if
        drawfilloval (Snow (rep).X, Snow (rep).Y, Snow (rep).Size, Snow (rep).Size, white)
    end for
    View.Update
    cls
end loop



thx - bye.
Sponsor
Sponsor
Sponsor
sponsor
pink00rock




PostPosted: Wed Feb 25, 2004 1:05 am   Post subject: (No subject)

and i was also wondering how i could get a picture on side.. like how everyone else has it? i'm a newbie so yeah lol. andd i'm sorry for posting this here.. not sure where to post this type of question. yup. see yeah for now.
Paul




PostPosted: Wed Feb 25, 2004 2:31 pm   Post subject: (No subject)

What kind of picture do you want? like a picture you found? then you use this kind of code:
code:

var picture := Pic.FileNew ("picture.bmp")
Pic.Draw (picture, 150, 70, picMerge)
pink00rock




PostPosted: Wed Feb 25, 2004 4:44 pm   Post subject: (No subject)

nooo i meant.. k u know how under your nick name is on the left side of the page INCLUDING your pciture underneath it.. how can i do that? i want a picture under my nick? and where do i go to do that.. thx bye!
jonos




PostPosted: Wed Feb 25, 2004 4:48 pm   Post subject: (No subject)

you should have used the turing reference man, the code there works and you will learn off it if you do a little reading. i would say more, but i will wait for shorthair to appear and do it right.

anyways, read up on records in the turing reference and the tutorial in the turing tutorial part of the site. anyways, i can't really explain the code because im not too familiar with records, but you could probably figure it out by reading up on it.

http://www.compsci.ca/v2/viewtopic.php?t=2325#20752

there is a very nice tutorial by your favourite spammer dodge tomahawk.
Paul




PostPosted: Wed Feb 25, 2004 5:14 pm   Post subject: (No subject)

Oh avatars, me an jonos misunderstood, we're dummies.
Refer to:
http://www.compsci.ca/v2/faq.php
under the subtitle of: User preferences and Settings
AsianSensation




PostPosted: Thu Feb 26, 2004 5:12 pm   Post subject: (No subject)

basicly, I created 100 snow "objects" that have their own coordinates, speed and size. I run a for loop to generate the values for these "objects" and then in the main loop, I just subtract the position of each snowflake by it's speed. And if it goes under the 0 line, so that you can't see it anymore, I just reassign some random position for the snowflake above the screen, so the snow is continuous, and I don't have to create new snow "objects" so it doesn't take up that much memory.

I did create a better snow program, it's somewhere on compsci, it's basicly the same idea, except the snow blows in 2D, instead of going straight down.
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  [ 7 Posts ]
Jump to:   


Style:  
Search: