Computer Science Canada Pls Help Me with Playing sounds after you press buttons on screen |
Author: | Shootforwhat [ Thu Mar 21, 2019 3:48 pm ] |
Post subject: | Pls Help Me with Playing sounds after you press buttons on screen |
Hello Im having trouble trying to create of program that lets you press two buttons and each time you press either of the buttons they make a sound, HOWEVER I am having a problem with trying to play the sound when you click the button. Here is the code: import GUI setscreen("graphics:300;125") process playstuff procedure hello locate(1,1) put "Hello User, you have clicked Button #1!" loop play ("cde") fork playstuff end loop end hello procedure hi locate(1,1) put "Hello User, you have clicked Button #2!!" loop play ("cde") fork playstuff end loop fork playstuff end hi end playstuff var button1:int:=GUI.CreateButton(25,25,0,"Button 1",hello) var button2:int:=GUI.CreateButton(25,50,0,"Button 2",hi) loop exit when GUI.ProcessEvent end loop |
Author: | Shootforwhat [ Thu Mar 21, 2019 6:52 pm ] |
Post subject: | Re: Pls Help Me with Playing sounds after you press buttons on screen |
nevermind, I found out how to do it this is the code: import GUI setscreen("graphics:300;125") put "Hello User, Welcome To (insert game title)" procedure hello locate(1,1) play ("a") end hello procedure hi locate(1,1) play ("a") end hi var button1:int:=GUI.CreateButton(25,25,0,"Exit",hello) var button2:int:=GUI.CreateButton(25,50,0,"Play",hi) loop exit when GUI.ProcessEvent end loop |