I use logical keyboard sensor bricks to control some actuators.

Now when one sensor occupies key A, and an other sensor occupies key A and modifier key SHIFT_LEFT, both of the sensor fire when SHIFT_LEFT + A is pressed.

Is there a way to set the first sensor so, that it only and really only is firing when solely A without any modifier key is pressed?

Thank you, Elmar


2 Answers 2



The issues is that you have an ambiguous description at the first place. The sensors do not (and should not) know of each other. They measure a specific event.

This means when you let a sensor measure for A it will measure exactly that regardless what other keys are pressed (as keys are independent from each other).

The keyboard sensor allows to sense the press of several keys at the same time. All of that keys needs to be pressed. This is - as in your situation - not in all situations what you want.


To get a more complex setup the controllers will help you.

You can combine sensor input in a logical way to get an activation or deactivation signal to the actuator.

  • if A+left Shift then activate X.
  • if A+not left Shift then activate Y.
  • if not A then activate Z.

Typically the "not" is more complicated.

The following examples assume A requests "move" while left Shift+A requests to "move turbo".

Inverted Sensor

enter image description here

You use a second sensor that inverts the output (keyboard sensor on left Shift with [invert] enabled).

This allows to use a simple controller e.g. AND


  • you have to configure the sensing twice (one inverted and one not inverted).

Expression controller

This allows you much more complex logic expressions.


  • You need to type rather than click.
  • Renaming the sensor will break the expression.

You need two sensors measuring each key.

enter image description here

Requesting "move":

The Expression controller measures turn and not turbo. This combines the two sensors (by name).

Requesting "move turbo":

You could use an Expression controller as well with turn and turbo, but the AND controller already does that. So it is cheaper with an AND controller.

Python Controller

You can use a Python controller to do the logical combination. But this is like buying a car factory just to get a car. It is possible, but for this purposes not worth.

State Machine

A complete different concept is the use of a state machine. Luckily there is one already build in.

You can define "move" and "move turbo" as two states plus one without moving: "waiting". You transit between the states via (sensors).

The advantage is that you do not need to worry the keys of the other states. You can even reuse keys (e.g. A means different things in different states).

But I think this does not really fit into your situation. So I will not explain it in more detail.

  • $\begingroup$ Monster, thank you for this detailed answer! Invert and Expression_Controller . This is the solution! I was wondering where the "not controller" is and how to set controllers in series. Now I understand, how it is really done the blender way. $\endgroup$
    – bue
    Jul 20, 2017 at 15:44

I think you will need to use a python controller to get that level of control.

Using the following script connected to an always sensor and two motion actuators should work the way you want.

import bge

ge = bge.events
ke = bge.logic.keyboard.events
is_active = bge.logic.KX_INPUT_ACTIVE

co = bge.logic.getCurrentController()
motion1 = co.actuators['Motion1']
motion2 = co.actuators['Motion2']

if ke[ge.AKEY] == is_active and ke[ge.LEFTSHIFTKEY] == is_active:
elif ke[ge.AKEY] == is_active:

  • $\begingroup$ Sambler, this works too. Thank you for the answer! In my case the simple use of the Invert_Sensor setting and the And_Controller already served my needs. $\endgroup$
    – bue
    Jul 20, 2017 at 15:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .