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

Username:   Password: 
 RegisterRegister   
 click a button, sound made
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
white_dragon




PostPosted: Sat May 15, 2004 4:32 pm   Post subject: click a button, sound made

this one should be easy but i can't figure it out.

how do u make it so then when someone clicks a button, it makes a sound. at the same time, they hafta wait a few seconds before they can fire again. something like a reload time.
Sponsor
Sponsor
Sponsor
sponsor
guruguru




PostPosted: Sat May 15, 2004 4:48 pm   Post subject: (No subject)

code:

var x, y, b : int

loop
    Mouse.Where (x, y, b)
    if b = 1 then
       play ("abcdefgabcd")
       delay(1000)
    end if
end loop
white_dragon




PostPosted: Sun May 16, 2004 4:58 pm   Post subject: (No subject)

tks. about the reload time............... after they click a button, can i make it so they hafta wait before they can click again?
SuperGenius




PostPosted: Sun May 16, 2004 5:58 pm   Post subject: (No subject)

That is already the case for that code because while the computer is waiting for the delay it will not recognize clicks.
Tony




PostPosted: Sun May 16, 2004 6:06 pm   Post subject: (No subject)

umm... no... cuz delay would pause the program itself. To emplement cooldown, you take system's time and save it in a variable. The user then cannot fire untill systemTime > (fireTime + cooldownTime) is satisfied.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
SuperGenius




PostPosted: Mon May 17, 2004 3:58 pm   Post subject: (No subject)

I was assuming that this code would be run in it's own process in a 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  [ 6 Posts ]
Jump to:   


Style:  
Search: