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

Username:   Password: 
 RegisterRegister   
 clear screen no working
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
bvbjules13




PostPosted: Sat Dec 15, 2012 11:24 pm   Post subject: clear screen no working

What is it you are trying to achieve?
clearing the screen

What is the problem you are having?
when i clear the screen the buttons i created wont go away not does the animation; i just get a frozen animation; im clearing the screen in the procedure corresponding with the button push; when i push the button everything clears but the button and then if i click the button again it goes away

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

Turing:


process Snow %process to have the snow animation and the title
    View.Set ("offscreenonly") %doing eveything from here offscreen
    loop
        Draw.Fill (1, 1, 16, 124) %making the whole screen black except the letters

       
        button := GUI.CreateButton (500, 300, 0, "SINGLE PLAYER", Single) %button for single player mode
        button := GUI.CreateButton (505, 270, 0, "MULTIPLAYER", Multiplayer) %button for multiplayer mode
        for i : 1 .. 500
            snow (i) := Rand.Int (1, 10) %assigning the amount the snowflake falls by
            yy (i) := yy (i) - snow (i) %subtracting the amount the snowflake falls by (so that the snowflake falls)
            if yy (i) < 0 then %if the snowflake reached the bottom; reset the variable for the snowflake
                yy (i) := Rand.Int (600, 700) %reassigning the snowflakes the hit the bottom of the screen; back to the top
            end if
            Draw.FillOval (xx (i), yy (i), 1, 1, white) %drawing the snowflake
        end for
        View.Update %updating what is on the screen
        delay (30)
        exit when done = true %when the hangman portion of the game starts; or instructions page
    end loop
    View.Set ("nooffscreenonly")
end Snow
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

fork PlayMusic %plays music
fork Snow  %starts the whole game; including animation and start page
loop
    exit when GUI.ProcessEvent
end loop



Please specify what version of Turing you are using
4.1
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Sun Dec 16, 2012 10:14 am   Post subject: RE:clear screen no working

You can't clear buttons with cls. You need to manually delete them with GUI.dispose or make them invisible with GUI.hide. Also, you're creating buttons in a loop. That's going to make it run very slowly.

code:
loop
    exit when GUI.ProcessEvent
end loop


What is the point of this loop? It doesn't do anything.

'Snow' should not be a process. It should be a procedure.
bvbjules13




PostPosted: Sun Dec 16, 2012 11:44 am   Post subject: Re: clear screen no working

i need to create the buttons in the loop or they wont display, and i tried GUI.Dispose it didnt work
Insectoid




PostPosted: Sun Dec 16, 2012 11:50 am   Post subject: RE:clear screen no working

Then you're doing it wrong.
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  [ 4 Posts ]
Jump to:   


Style:  
Search: