Key UP

How do I tell that a key is released using logic bricks? If the only way is Python please let me know where I might go. A little ryhme there. I want to stop a “walking sound” and start a “stop walking” sound when you release the forward key. I cant seem to find anything that supports this. Also, how do you set a boolean variable back to false by default when a key is not being pressed. Sorry for all the Q’s. I try to help out where I can here to make up for it!! :smiley:

hey,

you could use another sensor set up as for the key pressed. But click the Inv button to Inverse the sensor. so when its not pressed it fires.

hope you get this^ :S :slight_smile:

Hm, not sure if this is what you’re looking for.

In python you could always use the print command to see what the values of your variables are. With logic bricks you can debug in the same way.

Go to “Game” and click “Show Debug Properties”. Now for the variable values you want to see, click on the “D” all the way to the right of the property (It’ll be depressed). Click on any other properties you’d like to see variables for. Now when you run the game the debug properties will show up on the upper left hand corner.

Hope that helps, or maybe you already knew all that :smiley: .

Jason Lin

I’ve been working on something like this just a little. I want the motion to stop on its own after a set distance and not wait for a key release. It seems the key sends an opposite pulse when released. So a call to sensor.setUsePosPulseMode(0) will stop an actuator if it was recieving a positive pulse. Unfortunately, the same thing happens when the key is released because a negative pulse then starts the actuator, so I end up with two motions. I’ll have to use some kind of exclusion on the second one but haven’t gotten that far. Anyway a positive or negative signal is pulsed from a sensor until a key is released, then an opposite pulse is sent to turn off the actuator.

It’s pretty simple to set up, just have to set up some logicbricks + a property. I’ll make an example file:

http://www.free-webspace.biz/pooba/releasekey.blend
Right-click and hit save target as

YAY!

Pooba