Computer Science Canada

A snowMan made BY ME!!!!!!!!

Author:  rjm72 [ Wed Nov 10, 2004 2:04 pm ]
Post subject:  A snowMan made BY ME!!!!!!!!

I made this program today as an early christmas project! Its not that complicated but i still think it is cool 4 my first few weeks of class! 8) 8) 8) 8)

code:

%Ryan Murray TIK20
%October 8
%Snowman
setscreen ("offscreenonly")

procedure snowman (x, y : int, size : real)
    drawfilloval (x, y, round (size * 100), round (size * 100), white)
    drawfilloval (x, y + round (size * 155), round (size * 60), round (size * 60), white)
    drawfilloval (x, y - round (size * 245), round (size * 150), round (size * 150), white)
    drawfilloval (x, y, round (size * 7), round (size * 7), black)
    drawfilloval (x, y + round (size * 50), round (size * 7), round (size * 7), black)
    drawfilloval (x, y - round (size * 50), round (size * 7), round (size * 7), black)
    drawfilloval (x - round (size * 20), y + round (size * 155), round (size * 7), round (size * 7), black)
    drawfilloval (x + round (size * 20), y + round (size * 155), round (size * 7), round (size * 7), black)
    drawfilloval (x, y + round (size * 140), round (size * 10), round (size * 3), 42)
    drawfilloval (x, y + round (size * 120), round (size * 5), round (size * 5), black)
    drawfilloval (x + round (size * 20), y + round (size * 123), round (size * 5), round (size * 5), black)
    drawfilloval (x - round (size * 20), y + round (size * 123), round (size * 5), round (size * 5), black)
end snowman

procedure eraseSnowman (x, y : int, size : real)
    drawfilloval (x, y - round (size * 245), round (size * 150), round (size * 150), 29)
    drawfilloval (x, y + round (size * 155), round (size * 60), round (size * 60), blue)
end eraseSnowman



process motion (x : int)
    var x1, x2 : real
    x2 := 0.0
    x1 := .1 + Rand.Real * .5
    for i : 1 .. 50
        eraseSnowman (x, 200, x2)
        x2 := x2 + 0.01
        snowman (x, 200, x2)
        View.Update
        delay (50)
    end for
end motion

% MAIN PROGRAM %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
colorback (29)
cls



drawfillbox (0, maxy div 2, maxx, maxy, blue)


fork motion(100)
fork motion (300)
fork motion (500)


var pos1 : int
var pos2 : int
var count : int
count := 0

loop
    delay (10)
    pos1 := Rand.Int (1, 640)
    pos2 := Rand.Int (200, 480)
    count := count + 1
    drawfilloval (pos1, pos2, 1, 1, white)

    View.Update
    exit when count = 1000
end loop

Post your thoughts and any ideas or improvements u might hav! Very Happy Very Happy Very Happy

Author:  McKenzie [ Wed Nov 10, 2004 4:57 pm ]
Post subject: 

I like it for an early program but I suggest staying away from fork unless you need it. In this example I don't think you need it. This looks like an example of your teacher teaches WAY to slow for your liking so you learned advanced commands on your own.

Author:  cool dude [ Wed Nov 10, 2004 4:57 pm ]
Post subject: 

wow, i like the way u made the snowman look like it's coming forward but in reality u r just making it bigger. nice job. 8)

Author:  Hikaru79 [ Thu Nov 11, 2004 7:35 am ]
Post subject: 

Not bad! Very Happy

One suggestion though; find a way so that once the Snowman's have reached their maximum height, they won't be overlapped by the snow. Of course, this doesn't make a difference MOST of the time because they're white anyway. But if you leave it going long enough, you'll start to notice their eyes and buttons disappearing ^ ^;

GJ though Smile

Author:  djlenny_3000 [ Thu Nov 11, 2004 8:49 am ]
Post subject: 

a good program, i agree that the fork could have been changed but uts a good start

Author:  gigaman [ Thu Nov 11, 2004 10:40 am ]
Post subject: 

ya i think the fork is pretty useless

Author:  Viper [ Fri Nov 26, 2004 12:48 pm ]
Post subject: 

fyi,,actually we made the snowmen at midterm not first few weeks


: