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

Username:   Password: 
 RegisterRegister   
 the dropping snow
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
appling




PostPosted: Sat Nov 15, 2003 3:31 pm   Post subject: the dropping snow

how could i make the snow drop form the top.and the randint must be used. the snow i made is very messy. it only randint all over the screen.

code:
drawfillbox (1, 1, maxx, maxy, 1)
var x, y : int
for i : 1 .. 50
    randint (x, 0, maxx)
    randint (y, 0, maxy)
    drawfilloval (x, y, 3, 3, 0)
    delay (200)
end for


how could i do???
Sponsor
Sponsor
Sponsor
sponsor
AsianSensation




PostPosted: Sat Nov 15, 2003 3:45 pm   Post subject: (No subject)

Like This?

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


enjoy
appling




PostPosted: Sat Nov 15, 2003 3:51 pm   Post subject: (No subject)

thanks fo ur helping
Tony




PostPosted: Sat Nov 15, 2003 3:55 pm   Post subject: (No subject)

Asian - that looks preaty good. You should repost the code in [Turing Source Code] section
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Mazer




PostPosted: Sat Nov 15, 2003 4:07 pm   Post subject: (No subject)

or this?

code:

var win := Window.Open ("graphics:600;400,nobuttonbar,offscreenonly")
colourback (7)

var snowx, snowy, velx, vely : array 1 .. 75 of int

for i : 1 .. 75
    snowx (i) := Rand.Int (0, maxx + 400)
    snowy (i) := Rand.Int (0, maxy)
    velx (i) := Rand.Int (2, 4)
end for

loop
    exit when hasch
    for i : 1 .. 75
        drawfilloval (snowx (i), snowy (i), velx (i) div 2, velx (i) div 2, 0)
        snowx (i) -= velx (i)
        snowy (i) -= 4

        if snowy (i) < 0 or snowx (i) < 0 then
            snowx (i) := Rand.Int (0, maxx + 400)
            snowy (i) := maxy
        end if
    end for

    View.Update
    delay (25)
    cls
end loop

Window.Close (win)
AsianSensation




PostPosted: Sat Nov 15, 2003 4:16 pm   Post subject: (No subject)

nice Mazer, that's cool, outthought me by one more dimension, lol

I had to admit, it was Mazer's idea in Evasive Maneuver helped me to make that code, I got it from the credits, where the stars go past the screen.
Mazer




PostPosted: Sat Nov 15, 2003 4:34 pm   Post subject: (No subject)

lol, i love those credits! in fact.... i think i'll go watch them now. i keep forgetting who made that game!
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: