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.

DarkBASIC Discussion / I need help with a button code

Author
Message
Ghost Pirate Bob
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location:
Posted: 15th Jul 2004 05:24
I have three spheres right now...

When you hit A, the left lights up. S, the middle. And D, the right.

I dont want them to be on for as long as you hold down the key though.

I'd like that when you hit A, the left light turns on for a good 1/2 a second, then turns off, and wont turn back on until you physically take your finger off of A, and press it again.



Included is a rough idea of my code. Any idea anybody? Help would be appreciated

Me
JerBil
21
Years of Service
User Offline
Joined: 8th May 2004
Location: Somewhere along the Z axis...
Posted: 15th Jul 2004 06:55
Mr. Pirate,
This is one way to do least part of what you want.

if inkey$()="a"
color object 1,rgb(0,255,0)
w=timer()
while timer()-w<500
sync
endwhile
endif

-JerBil
Ghost Pirate Bob
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location:
Posted: 15th Jul 2004 15:58
I guess my question is kind of like this:

I have three spheres, Left, Middle and Right, activated by A S and D respectively

If you hit A, the left should turn on for a few instants.
If you continue to hold it, then the left does NOT remain on. It goes out.

If you hit S, then the middle should go on... but not while the left sphere is on, but holding the A key down should not affect whether the S key is on or not.

does that make sense?

Like, if you hit A then S then D then S then A

It should go:

Left turns on for a flash, Middle turns on for a flash, Right turns on for a flash, Middle, then Left.

But a human being isnt so nice about letting go of A before they hit S. So I need a way to compensate for that.

I'm programming an Amplitude/Frequency style game, and this has got me stumped.

Thanks for the help, I'll try to clarify better...
GNAAAR

Me

Login to post a reply

Server time is: 2025-05-25 00:49:27
Your offset time is: 2025-05-25 00:49:27