Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
crono12
20
Years of Service
User Offline
Joined: 1st Nov 2003
Location:
Posted: 20th Jan 2004 00:11
How do you use timer() for checking for key input.
Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 20th Jan 2004 00:29
timer() has nothing to do with the keyboard

a
crono12
20
Years of Service
User Offline
Joined: 1st Nov 2003
Location:
Posted: 20th Jan 2004 00:43
Not for checking the actual input but to make it so that you can't press a button so rapidly.
the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 20th Jan 2004 02:57
Raw function pulled straight from one of my games.



You could do it that way or to use the timer, psudo code.

last = timer()
do
if timer() - last > 500
`get imput
last = timer()
endif
loop

Can I scream?
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 20th Jan 2004 04:26
This method prevents any repeats from the user holding the key down.
They must release the key before they can press it again.

if spacekey()=1 and flag=0 then flag=1

if spacekey()=0 then flag=0

"eureka" - Archimedes

Login to post a reply

Server time is: 2024-09-21 18:39:29
Your offset time is: 2024-09-21 18:39:29