Unable to remove GUI buttons
Author |
Message |
Ernest
|
Posted: 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
|
|
|
5c0r910n
|
Posted: Thu Jan 19, 2017 1:06 pm Post subject: RE:Unable to remove GUI buttons |
|
|
Have you tried GUI.Disable, then clearing the screen? |
|
|
|
|
|
|
|