Computer Science Canada

add clouds moving and a snowman moving please appreciate it

Author:  dontknowwhattodo [ Wed Mar 09, 2011 11:08 pm ]
Post subject:  add clouds moving and a snowman moving please appreciate it

type FlakeType :
record
x, y, speed, size : real
end record
var x, y, button : int := 0
var size : int := 200
var inuse : boolean := false
var Snow : array 1 .. size of FlakeType
const delaytime := 1000000000
procedure DrawBack
var cox : array 1 .. 11 of int := init (123, 35, 85, 35, 85, 35, 211, 161, 211, 161, 211)
var coy : array 1 .. 11 of int := init (400, 300, 300, 230, 230, 150, 150, 230, 230, 300, 300)
var conx : array 1 .. 3 of int := init (400, 400, 470)
var cony : array 1 .. 3 of int := init (295, 275, 285)
var roofx : array 1 .. 4 of int := init (300, 400, 610, 700)
var roofy : array 1 .. 4 of int := init (300, 450, 450, 300)
drawfillbox (0, 0, 800, 600, black) %background
drawfillbox (0, 0, 800, 100, grey) %background

drawfilloval (740, 520, 45, 45, grey) %moon
drawfilloval (710, 520, 30, 35, black) %moon

drawfillstar (290, 530, 210, 540, darkgrey)
drawfillstar (250, 580, 260, 590, darkgrey)
drawfillstar (320, 480, 330, 490, darkgrey)
drawfillstar (50, 530, 60, 540, darkgrey)
drawfillstar (470, 560, 480, 570, darkgrey)
drawfillstar (100, 490, 110, 500, darkgrey)
drawfillstar (400, 525, 410, 535, darkgrey)
drawfillstar (340, 555, 350, 565, darkgrey)
drawfillstar (280, 520, 290, 530, darkgrey)
drawfillstar (550, 585, 560, 595, darkgrey)



drawfillbox (95, 101, 151, 149, 119) %christmas tree's trunk
Draw.FillPolygon (cox, coy, 11, red) %christmas tree
end DrawBack
procedure GenerateFlake
for i : 1 .. size
Snow (i).x := Rand.Int (0, maxx)
Snow (i).y := Rand.Int (0, maxy)
Snow (i).speed := Rand.Real * Rand.Int (1, 3)
Snow (i).size := Snow (i).speed
end for
end GenerateFlake
process GenerateX
if (not (inuse)) then
x := Rand.Int (-600, 600)
inuse := true
delay (2500)
inuse := false
end if
end GenerateX
process LetItSnow
loop
fork GenerateX
for i : 1 .. size


Snow (i).y -= Snow (i).speed
Snow (i).x += round (x / 10000)
if Snow (i).y < 0 then
Snow (i).y := Rand.Int (maxy, maxy + 100)
end if
if Snow (i).x > maxx then
Snow (i).x := Rand.Int (-10, 0)
end if
if Snow (i).x < 0 then
Snow (i).x := Rand.Int (maxx, maxx + 1000)
end if
drawfilloval (round (Snow (i).x), round (Snow (i).y), round (Snow (i).size), round (Snow (i).size), white)
end for
View.Update
for o : 1 .. size
drawfilloval (round (Snow (o).x), round (Snow (o).y), round (Snow (o).size), round (Snow (o).size), blue)
end for
DrawBack
end loop
end LetItSnow
%Main function:
View.Set ("graphics:800,600") %Set the view to 800x600 graphics mode.
View.Set ("offscreenonly")
View.Set ("title: Winter Scene !!") %Set drawing to offscreen only.
drawfillbox (0, 0, maxx, maxy, blue) %Draw the initial black background.
GenerateFlake %Generate the snow flake
fork LetItSnow %Let it snow!

Author:  Insectoid [ Wed Mar 09, 2011 11:24 pm ]
Post subject:  RE:add clouds moving and a snowman moving please appreciate it

You know, I don't think I will.

Author:  apython1992 [ Wed Mar 09, 2011 11:29 pm ]
Post subject:  RE:add clouds moving and a snowman moving please appreciate it

Nobody will do it for you, but we'd be willing to help. Where are you having trouble?

Author:  ProgrammingFun [ Wed Mar 09, 2011 11:51 pm ]
Post subject:  Re: RE:add clouds moving and a snowman moving please appreciate it

Instead of posting so many lines of code, you can just upload a .t file.
And I didn't see any snowman.... Rolling Eyes
apython1992 @ Wed Mar 09, 2011 11:29 pm wrote:
Nobody will do it for you, but we'd be willing to help. Where are you having trouble?

I would think that they just wanted to share the program....since it's in Turing Submissions....maybe I'm wrong Question
Insectoid @ Wed Mar 09, 2011 11:24 pm wrote:
You know, I don't think I will.

Laughing

Author:  Tony [ Thu Mar 10, 2011 12:09 am ]
Post subject:  Re: RE:add clouds moving and a snowman moving please appreciate it

ProgrammingFun @ Wed Mar 09, 2011 11:51 pm wrote:
I would think that they just wanted to share the program....since it's in Turing Submissions...

You might be over-estimating people's ability for reading comprehension.

P.S. moved it to Turing Help

Author:  apython1992 [ Thu Mar 10, 2011 9:53 am ]
Post subject:  Re: RE:add clouds moving and a snowman moving please appreciate it

ProgrammingFun @ Wed Mar 09, 2011 11:51 pm wrote:
Instead of posting so many lines of code, you can just upload a .t file.
And I didn't see any snowman.... Rolling Eyes
apython1992 @ Wed Mar 09, 2011 11:29 pm wrote:
Nobody will do it for you, but we'd be willing to help. Where are you having trouble?

I would think that they just wanted to share the program....since it's in Turing Submissions....maybe I'm wrong Question
Insectoid @ Wed Mar 09, 2011 11:24 pm wrote:
You know, I don't think I will.

Laughing


I figured that the topic title suggested he was asking for help.

Author:  ProgrammingFun [ Thu Mar 10, 2011 5:57 pm ]
Post subject:  Re: add clouds moving and a snowman moving please appreciate it

apython1992 wrote:
I figured that the topic title suggested he was asking for help.

Oh....my bad... Embarassed

Tony wrote:
You might be over-estimating people's ability for reading comprehension.

I probably am... Laughing


: