How can I detect when a key has been released?

About advanced scenes, and the Thyme scripting language used in Algodoo.

How can I detect when a key has been released?

Postby Xray » Sat Sep 08, 2012 4:18 am

I am currently working on a scene that requires the user to press and release keyboard keys. It's easy to activate a laser when a key gets pressed, for example, which sets a variable. But when the key is released, and the laser turns off, the variable in OnLaserHit or OnHitByLaser does not automatically get reset to zero. I figured out how to detect when a keypress is released using a motor-driven circle (arrrrgh!), but does anyone know a clever way to detect when a key is released without using mechanical devices such as motors turning, or boxes bumping into each other, etc? I want to do it with Thyme script alone, and of course with a laser that gets activated when a particular key is pressed.

Thanks!
User avatar
Xray
 
Posts: 501
Joined: Sun Jun 17, 2012 6:12 am
Location: USA

Re: How can I detect when a key has been released?

Postby Xray » Sat Sep 08, 2012 8:23 am

I DID SOME MORE DIGGING THROUGH THE FORUMS AND I FOUND WHAT I WAS LOOKING FOR: http://www.algodoo.com/algobox/details.php?id=50835
User avatar
Xray
 
Posts: 501
Joined: Sun Jun 17, 2012 6:12 am
Location: USA

Re: How can I detect when a key has been released?

Postby Kilinich » Sat Sep 08, 2012 9:52 am

good job ;-)
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: How can I detect when a key has been released?

Postby Xray » Sat Sep 08, 2012 5:30 pm

Kilinich wrote:good job ;-)


Kilinich - It was YOUR clever scene that I used! Thanks very much for all the useful ideas that you come up with! :clap: :thumbup:

By the way, I am currently working on an Enigma cipher machine. It is very difficult and challenging, but I am making good progress. I will publish it some time this weekend.
User avatar
Xray
 
Posts: 501
Joined: Sun Jun 17, 2012 6:12 am
Location: USA


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 4 guests