Python detecting negatives

I’m working on a script for python and I need some help getting it to work right. I am trying to set up a script that controls the movement of a cube, and I’m trying to do this using ray sensors. Right now I’m trying to figure out how to have the script set up to detect if the cube isn’t sensing an obstacle.

Here’s a small part of the script

if front_start.hitObject:
    frontstart = 1
if frontstart == 1 and front_stop.hitObject:
    if rotate > 0:
        rotate = .0055
    elif rotate < 0:
        rotate = .0055
    elif roate == 0:    
        if variable == 0:
        rotate = .0035
    elif variable == 1:
        rotate = -.0035
if front_stop.?????? and front_start.?????:
    frontstart = 0

At the very end where I shoved in a bunch of question marks is where I need help. I’m not sure what to put. but the basic idea is for something to be there that will detect if the cube isn’t sensing an object. Any help will be appreciated. :slight_smile:

To see if something is not positive, the code would be:

if not front_stop.positive:

You should take a look at the GameEngine API. (The ray sensor section)

That should help.
-Sunjay03

Sunjay showed you the right way.

On the over side, you already used

 
if front_start.hitObject:

the opposite of that is

 
if not front_start.hitObject: