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

Username:   Password: 
 RegisterRegister   
 Pls Help Me with Playing sounds after you press buttons on screen
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Shootforwhat




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Shootforwhat




PostPosted: 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 Embarassed
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
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: