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
Yoshiman1
20
Years of Service
User Offline
Joined: 12th May 2004
Location:
Posted: 25th Jul 2004 05:37
Is there a way in DarkBasic Classic to check if something is doing something and make it react only once?

For example, if you have

if upkey()=1 then append object animation yada yada

Is there a way to make it append the object animation only once, so that it does it only once while you hold the up key?
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 25th Jul 2004 06:09
Sure

Outside your main loop, create a variable like so



React to the upkey like this:



Setting the variable will stop the upkey being reacted to a second time.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk
Ilya
21
Years of Service
User Offline
Joined: 10th Aug 2003
Location:
Posted: 25th Jul 2004 10:11
and also add this:


-Ilya
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 25th Jul 2004 11:35
Err, no.

That change makes the upkey only active once while the key is held down, rather than only running the code once ever when it is pressed.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk

Login to post a reply

Server time is: 2024-09-22 18:36:49
Your offset time is: 2024-09-22 18:36:49