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

Username:   Password: 
 RegisterRegister   
 Unable to remove GUI buttons
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Ernest




PostPosted: Tue Jan 17, 2017 7:37 pm   Post subject: Unable to remove GUI buttons

What is it you are trying to achieve?
Remove the GUI button created by the previous scene.

What is the problem you are having?
This game is supposed to move to different scene by calling in different images and creating different GUI buttons at the bottom for the user to choose from. I'm unable to remove the GUI buttons that are created previously.


Describe what you have tried to solve this problem
I have tried using GUI.Hide, GUI.Dispose, and even creating a procedure as seen at the top of this code.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
This is a section of the code that I'm having the GUI button issue with.

Turing:


%Game Over Procedures
body procedure Dispose_GUI
    var button1 : int
    var button2 : int
    var button3 : int
    GUI.Dispose (button1)
    GUI.Dispose (button2)
    GUI.Dispose (button3)
end Dispose_GUI
   
body procedure death_1
    cls
    var death_vent : int := Pic.FileNew ("death_vent.bmp")
    Pic.DrawSpecial (death_vent, 0, 0, 0, picFadeIn, 1000)
    Music.PlayFile ("wasted.wav")
    var button01 : int := GUI.CreateButton (400, 150, 100, "RESTART", Restart_Game)
    var button02 : int := GUI.CreateButton (800, 150, 100, "QUIT", ButtonQuit)
    loop
        exit when GUI.ProcessEvent
    end loop
end death_1

body procedure death_2
    cls
    var death_washroom : int := Pic.FileNew ("death_washroom.bmp")
    Pic.DrawSpecial (death_washroom, 0, 0, 0, picFadeIn, 1000)
    Music.PlayFile ("wasted.wav")
    delay (3000)
    var button01 : int := GUI.CreateButton (400, 150, 100, "RESTART", Restart_Game)
    var button02 : int := GUI.CreateButton (800, 150, 100, "QUIT", ButtonQuit)
    loop
        exit when GUI.ProcessEvent
    end loop
end death_2

body procedure death_3
    finished_ambience := true
    var death_hallway : int := Pic.FileNew ("death_hallway.bmp")
    Pic.DrawSpecial (death_hallway, 0, 0, 0, picFadeIn, 1000)
    Music.PlayFile ("wasted.wav")
    delay (3000)
    var button02 : int := GUI.CreateButton (400, 150, 100, "RESTART", Restart_Game)
    var button01 : int := GUI.CreateButton (800, 150, 100, "QUIT", ButtonQuit)
    loop
        exit when GUI.ProcessEvent
    end loop
end death_3

body procedure death_4
    finished_ambience := true
    var death_secondroom : int := Pic.FileNew ("death_secondroom.bmp")
    Pic.DrawSpecial (death_secondroom, 0, 0, 0, picFadeIn, 1000)
    Music.PlayFile ("wasted.wav")
    delay (3000)
    var button01 : int := GUI.CreateButton (400, 150, 100, "RESTART", Restart_Game)
    var button02 : int := GUI.CreateButton (800, 150, 100, "QUIT", ButtonQuit)
    loop
        exit when GUI.ProcessEvent
    end loop
end death_4

body procedure death_5
    finished_ambience := true
    var death_closet : int := Pic.FileNew ("death_closet.bmp")
    Pic.DrawSpecial (death_closet, 0, 0, 0, picFadeIn, 1000)
    Music.PlayFile ("wasted.wav")
    delay (3000)
    var button01 : int := GUI.CreateButton (400, 150, 100, "RESTART", Restart_Game)
    var button02 : int := GUI.CreateButton (800, 150, 100, "QUIT", ButtonQuit)
    loop
        exit when GUI.ProcessEvent
    end loop
end death_5

body procedure death_6
    finished_ambience := true
    var death_investigate : int := Pic.FileNew ("death_fall.bmp")
    Pic.DrawSpecial (death_investigate, 0, 0, 0, picFadeIn, 1000)
    Music.PlayFile ("wasted.wav")
    delay (3000)
    var button01 : int := GUI.CreateButton (400, 150, 100, "RESTART", Restart_Game)
    var button02 : int := GUI.CreateButton (800, 150, 100, "QUIT", ButtonQuit)
    loop
        exit when GUI.ProcessEvent
    end loop
end death_6

body procedure death_7
    finished_ambience := true
    var death_door : int := Pic.FileNew ("death_door.bmp")
    Pic.DrawSpecial (death_door, 0, 0, 0, picFadeIn, 1000)
    Music.PlayFile ("wasted.wav")
    delay (3000)
    var button01 : int := GUI.CreateButton (400, 150, 100, "RESTART", Restart_Game)
    var button02 : int := GUI.CreateButton (800, 150, 100, "QUIT", ButtonQuit)
    loop
        exit when GUI.ProcessEvent
    end loop
end death_7

body procedure death_8
    finished_ambience := true
    var death_fall : int := Pic.FileNew ("death_fall.bmp")
    Pic.DrawSpecial (death_fall, 0, 0, 0, picFadeIn, 1000)
    Music.PlayFile ("wasted.wav")
    delay (3000)
    var button01 : int := GUI.CreateButton (400, 150, 100, "RESTART", Restart_Game)
    var button02 : int := GUI.CreateButton (800, 150, 100, "QUIT", ButtonQuit)
    loop
        exit when GUI.ProcessEvent
    end loop
end death_8

body procedure death_9
    finished_ambience := true
    var death_wait : int := Pic.FileNew ("death_wait.bmp")
    Pic.DrawSpecial (death_wait, 0, 0, 0, picFadeIn, 1000)
    Music.PlayFile ("wasted.wav")
    delay (3000)
    var button01 : int := GUI.CreateButton (400, 150, 100, "RESTART", Restart_Game)
    var button02 : int := GUI.CreateButton (800, 150, 100, "QUIT", ButtonQuit)
    loop
        exit when GUI.ProcessEvent
    end loop
end death_9


%Procedure Scene_1
body procedure Scene_1 ()
    cls
    var scene_1 : int := Pic.FileNew ("scene_1.bmp")
    Pic.DrawSpecial (scene_1, 0, 0, 0, picFadeIn, 1000)
    delay (3000)
    var button1 : int := GUI.CreateButton (100, 20, 100, "Esccape through the vent", death_1) %GUI Button
    var button2 : int := GUI.CreateButton (550, 20, 100, "Go to the hallway", Scene_2)
    var button3 : int := GUI.CreateButton (980, 20, 100, "Go to the washroom", death_2)
    loop
        exit when GUI.ProcessEvent
    end loop
end Scene_1

body procedure Scene_2 ()
    cls
    var scene_2 : int := Pic.FileNew ("scene_2.bmp")
    Pic.DrawSpecial (scene_2, 0, 0, 0, picFadeIn, 1000)
    delay (3000)
    var button4 : int := GUI.CreateButton (100, 20, 100, "Go to the first room", Scene_3) %GUI Button
    var button5 : int := GUI.CreateButton (550, 20, 100, "Go to the second room", death_4)
    var button6 : int := GUI.CreateButton (980, 20, 100, "Turn right", death_3)
    Dispose_GUI
    loop
        exit when GUI.ProcessEvent
    end loop
end Scene_2

body procedure Scene_3 ()
    cls
    var scene_3 : int := Pic.FileNew ("scene_3.bmp")
    Pic.DrawSpecial (scene_3, 0, 0, 0, picFadeIn, 1000)
    delay (3000)
    var button7 : int := GUI.CreateButton (100, 20, 100, "Open the closet", death_5) %GUI Button
    var button8 : int := GUI.CreateButton (980, 20, 100, "Smash the window", Scene_4)
    loop
        exit when GUI.ProcessEvent
    end loop
end Scene_3

body procedure Scene_4 ()
    cls
    var scene_9 : int := Pic.FileNew ("scene_9.bmp")
    Pic.DrawSpecial (scene_9, 0, 0, 0, picFadeIn, 1000)
    delay (3000)
    var button9 : int := GUI.CreateButton (100, 20, 100, "Closet", death_5) %GUI Button
    var button10 : int := GUI.CreateButton (980, 20, 100, "Bed ", Scene_5)
    loop
        exit when GUI.ProcessEvent
    end loop
end Scene_4

body procedure Scene_5 ()
    cls
    var scene_5 : int := Pic.FileNew ("scene_5.bmp")
    Pic.DrawSpecial (scene_5, 0, 0, 0, picFadeIn, 1000)
    delay (3000)
    var button11 : int := GUI.CreateButton (100, 20, 100, "Go outside", death_7) %GUI Button
    var button12 : int := GUI.CreateButton (980, 20, 100, "Wait 5 more minutes", Scene_6)
    loop
        exit when GUI.ProcessEvent
    end loop
end Scene_5

body procedure Scene_6 ()
    cls
    var scene_6 : int := Pic.FileNew ("scene_6.bmp")
    Pic.DrawSpecial (scene_6, 0, 0, 0, picFadeIn, 1000)
    delay (3000)
    var button13 : int := GUI.CreateButton (100, 20, 100, "Stay for another 5 minutes", death_9) %GUI Button
    var button14 : int := GUI.CreateButton (980, 20, 100, "Wait 5 more minutes", Scene_7)
    loop
        exit when GUI.ProcessEvent
    end loop
end Scene_6

body procedure Scene_7 ()
    cls
    var scene_7 : int := Pic.FileNew ("scene_7.bmp")
    Pic.DrawSpecial (scene_7, 0, 0, 0, picFadeIn, 1000)
    delay (3000)
    var button15 : int := GUI.CreateButton (550, 20, 100, "Get in the car", Scene_8)
    loop
        exit when GUI.ProcessEvent
    end loop
end Scene_7

body procedure Scene_8 ()
    cls
    var scene_8 : int := Pic.FileNew ("scene_8.bmp")
    Pic.DrawSpecial (scene_8, 0, 0, 0, picFadeIn, 1000)
    delay (3000)
    var button16 : int := GUI.CreateButton (550, 20, 100, "Start the engine and leave", Scene_8)
    loop
        exit when GUI.ProcessEvent
    end loop
end Scene_8



Please specify what version of Turing you are using
4.1.1
Sponsor
Sponsor
Sponsor
sponsor
5c0r910n




PostPosted: Thu Jan 19, 2017 1:06 pm   Post subject: RE:Unable to remove GUI buttons

Have you tried GUI.Disable, then clearing the screen?
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  [ 2 Posts ]
Jump to:   


Style:  
Search: