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

Username:   Password: 
 RegisterRegister   
 need help to fix this scene. Can't intergrate snow program into the actual program
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
universalswag




PostPosted: Wed Jan 16, 2013 3:45 pm   Post subject: need help to fix this scene. Can't intergrate snow program into the actual program

What is it you are trying to achieve?
So our assignment is to make a christmas scene. I made a scene where everything is messed up, and put the caption "Go home Santa, You're drunk". However, when i try to put the snow ( Which i do not take credit for, teacher told us to take off internet), it does not sync with my stuff. Everything goes white.

What is the problem you are having?
I cannot get the snow to work in conjunction with my program. I have no idea. Project due soon. Any input is appreciated.


Describe what you have tried to solve this problem
I was tried putting snow in different paarts of my program. Tried cls, and View.Update.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)


Turing:


This is my program:
%ICS201
%Mrs. Mihaila,
%Peter Chen
%Summative
%****************WINTER SCENE*********************
View.Set ("graphics:max;max")
View.Set ("offscreenonly")



process bob
    loop
        for changingwindows : 0 .. 150
            Draw.FillBox (494, 320, 753, 298, changingwindows) %middle window
            Draw.FillBox (531, 130, 722, 243, changingwindows) %garage door
            %Double Triangles ont top of pilars
            Draw.Line (403, 344, 479, 344, changingwindows) %Drawing bottom line of observation deck#1
            Draw.Line (479, 344, 479, 412, changingwindows) %Drawing right line of observation deck#1
            Draw.Line (479, 412, 403, 344, changingwindows) %Drawing left line of observation deck#1
            Draw.Fill (457, 356, changingwindows, changingwindows) %Filling in observation deck#1
            Draw.Line (855, 344, 779, 344, changingwindows) %Drawing bottom line of observation deck#2
            Draw.Line (855, 344, 779, 412, changingwindows) %Drawing right line of observation deck#2
            Draw.Line (779, 412, 779, 344, changingwindows) %Drawing left line of observation deck#2
            Draw.Fill (800, 367, changingwindows, changingwindows) %Filling in observation deck#2
            delay (90)
            View.Update
        end for
    end loop
end bob
fork bob

%Neptune
process mike
    loop
        for yolo : 62 .. 100

            Draw.FillOval (123, 583, 70, 70, yolo) %Neptune water
            Draw.FillOval (93, 533, 20, 4, yolo + 10) %Clouds of neptune
            Draw.FillOval (139, 549, 40, 5, yolo + 10) %"    "
            Draw.FillOval (126, 527, 10, 3, yolo + 10) %"    "
            Draw.FillOval (117, 569, 60, 7, yolo + 10) %"    "
            Draw.FillOval (98, 592, 40, 5, yolo + 10) %"    "
            Draw.FillOval (160, 610, 20, 4, yolo + 10) %"    "
            Draw.FillOval (116, 624, 10, 3, yolo + 10) %"    "
            Draw.FillOval (81, 609, 20, 4, yolo + 10) %"    "
            Draw.FillOval (128, 638, 20, 4, yolo + 10) %"    "

            delay (150)
            View.Update
        end for
    end loop
end mike
fork mike

%Disco Craters
process joe
    loop
        for swag : 32 .. 51
            Draw.FillOval (243, 50, 40, 20, swag) %crater (hole)
            Draw.FillOval (919, 98, 40, 20, swag) %crater (hole2)
            Draw.FillOval (770, 21, 50, 30, swag) %crater (hole3)
            Draw.FillOval (410, 95, 30, 10, swag) %crater (hole4)
            delay (100)
            View.Update
        end for
    end loop
end joe
fork joe

%Around neptune
process orbrings
    for rings : 75 .. 80
        Draw.Oval (123, 583, rings, rings, yellow)
        Draw.Oval (123, 583, rings + 5, rings + 5, yellow)
        Draw.Oval (123, 583, rings + 10, rings + 10, yellow)
        delay (50)
    end for
end orbrings
fork orbrings



Draw.FillBox (0, 0, maxx, maxy, blue) %background
Draw.FillOval (653, -600, 1000, 1000, grey)             %The moon
Draw.Line (403, 344, 479, 344, white)             %Drawing bottom line of observation deck#1
Draw.Line (479, 344, 479, 412, white)             %Drawing right line of observation deck#1
Draw.Line (479, 412, 403, 344, white)             %Drawing left line of observation deck#1
Draw.Fill (457, 356, white, white)             %Filling in observation deck#1
Draw.Line (855, 344, 779, 344, white)             %Drawing bottom line of observation deck#2
Draw.Line (855, 344, 779, 412, white)             %Drawing right line of observation deck#2
Draw.Line (779, 412, 779, 344, white)             %Drawing left line of observation deck#2
Draw.Fill (800, 367, white, white)             %Filling in observation deck#2
Draw.FillBox (460, 354, 840, 150, black)             %background of red building
%Pillars on both sides



Draw.FillBox (460, 354, 794, 130, black) %background of red building
Draw.FillBox (789, 126, 855, 344, black) %Pillar on right side
Draw.FillBox (466, 126, 402, 344, black) %Pillar on left side
Draw.FillBox (465, 132, 790, 350, red) %House unit
Draw.FillBox (528, 246, 724, 127, black) %background of garage door
Draw.FillBox (531, 130, 722, 243, white) %garage door
Draw.FillBox (491, 294, 758, 324, black) %background of window
Draw.FillBox (494, 320, 753, 298, yellow) %middle window
%High Flying Snoman
Draw.FillOval (864, 587, 20, 20, white)
Draw.FillOval (853, 592, 3, 3, black)
Draw.FillOval (870, 592, 3, 3, black)
Draw.FillOval (891, 556, 30, 30, white)
Draw.FillOval (921, 515, 40, 40, white)
Draw.FillOval (885, 561, 2, 2, black)
Draw.FillOval (892, 551, 2, 2, black)
Draw.FillOval (900, 541, 2, 2, black)
Draw.Line (861, 585, 841, 581, 41)
Draw.Line (860, 581, 861, 585, 41)
Draw.Line (860, 581, 841, 581, 41)
Draw.Fill (858, 582, 41, 41)
process fontmoving

for movingfont:0..255
var font1:int
font1:=Font.New ("Arial:14")
Font.Draw ("Go Home Santa, You're Drunk!",10,3,font1,movingfont)
Font.Free (font1)
View.Update
delay (50)
end for
end fontmoving
fork fontmoving

%Starsnstuff
process swagstar
    loop
        for yellows : 34 .. 67
            drawfillstar (470, 560, 480, 570, yellows)
            drawfillstar (225, 410, 235, 420, yellows)
            drawfillstar (1170, 370, 1180, 380, yellows)
            drawfillstar (970, 370, 980, 380, yellows)
            drawfillstar (860, 510, 870, 520, yellows)
            drawfillstar (400, 525, 410, 535, yellows)
            drawfillstar (340, 555, 350, 565, yellows)
            drawfillstar (280, 520, 290, 530, yellows)
            drawfillstar (550, 585, 560, 595, yellows)
            drawfillstar (530, 495, 540, 505, yellows)
            drawfillstar (550, 585, 560, 595, yellows)
           
        end for
    end loop
end swagstar
fork swagstar



process yellowstar
    loop
        for yello : 14 .. 15
            drawfillstar (600, 555, 610, 565, yello)
            drawfillstar (424, 632, 434, 642, yello)
            drawfillstar (325, 478, 335, 488, yello)
            drawfillstar (580, 510, 590, 520, yello)
            drawfillstar (690, 460, 700, 470, yello)
            drawfillstar (686, 660, 696, 670, yello)
            drawfillstar (145, 460, 155, 470, yello)
            drawfillstar (88, 305, 98, 315, yello)
            drawfillstar (730, 600, 740, 610, yello)

            drawfillstar (860, 630, 870, 640, yello)
            drawfillstar (860, 440, 870, 450, yello)
            drawfillstar (985, 477, 995, 487, yello)

            drawfillstar (1130, 590, 1140, 600, yello)
            drawfillstar (1070, 500, 1080, 510, yello)
            delay (50)
        end for
    end loop
end yellowstar
fork yellowstar

%Broken Tree
Draw.Line (286,286,256,330,brown)
Draw.Line (319,286,286,286,brown)
Draw.Line (292,329,319,286,brown)
Draw.Line (256,330,292,329,brown)
Draw.Fill (290,311,brown,brown)
Draw.Line (315,135,334,195,49)
Draw.Line (315,135,296,195,49)
Draw.Line (334,195,296,195,49)
Draw.Fill (312,174,49,49)
Draw.Line (318,173,275,243,49)
Draw.Line (318,173,350,243,49)
Draw.Line (275,243,350,243,49)
Draw.Fill (316,229,49,49)
Draw.Line (310,221,256,285,49)
Draw.Line (310,221,356,305,49)
Draw.Line (356,305,256,285,49)
Draw.Fill (304,273,49,49)

% A person
%Chest
Draw.Line (964,284,1002,305,red)
Draw.Line (1002,305,1015,267,red)
Draw.Line (992,253,964,284,red)
Draw.Line (992,253,1015,267, red)
Draw.Fill (991,273,red,red)

drawfillstar (300,120,330,150,yellow)

snow code:

type SnowType :
record
X, Y, Spd, Size : int%Define the integers
end record
var Snow : array 1 ..200 of SnowType%Array
for rep : 1 .. 200 %For statement
Snow (rep).X := Rand.Int (0, maxx)
Snow (rep).Y := Rand.Int (0, maxy)
Snow (rep).Spd := Rand.Int (1, 3)
Snow (rep).Size := Snow (rep).Spd
end for
loop%loops the screen
for rep : 1 .. 100
Snow (rep).Y -= Snow (rep).Spd
if Snow (rep).Y < Snow (rep).Size then%If statement
Snow (rep).Y := Rand.Int (1000, 1000)
end if%Ends if statement
drawfilloval (Snow (rep).X, Snow (rep).Y, Snow (rep).Size, Snow (rep).Size, white)%generate the snow size
end for%End for process
View.Update%Update the screen
cls%Clear the screen





Please specify what version of Turing you are using
im Using the latest version of turing
Sponsor
Sponsor
Sponsor
sponsor
Panphobia




PostPosted: Wed Jan 16, 2013 10:49 pm   Post subject: RE:need help to fix this scene. Can\'t intergrate snow program into the actual program

try taking cls out from the snow loop, this will not completely solve it, but it will make it easier
evildaddy911




PostPosted: Wed Jan 16, 2013 11:56 pm   Post subject: RE:need help to fix this scene. Can\'t intergrate snow program into the actual program

First, when you want to post a longer program (~150+ lines) you should post the file as an attachment. At the bottom of the posting page theres an attachments section.
Now onto the problem:
Your attempting to loop/delay proceses in Turing; that never works properly because of the way they are implemented. Another problem is that you dont draw everything in some sort of loop, so that stuff only gets drawn once, but then the cls call clears those things out.
My suggestion is to have a procedure (or just do it directly from the main loop) that draws the background and another that handles the animation (again, can be done directly from the loop), all in one loop and leave out the processes altogether.
neuro.akn




PostPosted: Thu Jan 17, 2013 11:44 am   Post subject: RE:need help to fix this scene. Can\'t intergrate snow program into the actual program

Also, you should try using procedures instead of processes and see if it works, because processes are really only useful in adding background music.
Tony




PostPosted: Thu Jan 17, 2013 1:40 pm   Post subject: RE:need help to fix this scene. Can\'t intergrate snow program into the actual program

You already asked this question http://compsci.ca/v3/viewtopic.php?t=33047 and previously received the same response Wink
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
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  [ 5 Posts ]
Jump to:   


Style:  
Search: