Why is my code only reading the first condition and not checking for the second?

Why is my code only reading the first condition and not checking for the second condition on my code.

def primary():
    if keyPress.positive:    
        if raySensor.hitObject['primaryWeapon']:
            own['primary'] = raySensor.hitObject['weaponName']
        elif raySensor.hitObject['secondaryWeapon']:
            own['secondary'] = raySensor.hitObject['weaponName']

primary()            

Upvotes: 0

Views: 57

Answers (1)

After a day. Finally I've found a solution. It think the problem is with me using Boolean instead of a string. It got me thinking so hard and I had to try out a lot of ideas on how to fix this. Anyway thank you guys for you participation.

Upvotes: 0

Related Questions