1
$\begingroup$

I have the following code:

import bge
from bge import logic

def property(cont):    
    own = cont.owner

    if 'Recoil_Level' in own and 'Section' in own:

        level = own['Recoil_Level']
        sec = own['Recoil_Section']

    else:
        print('Missing properties in object')
        return

    if (level >= 0) and (level <= 0.5):
        own['Recoil_Section'] = 1

    if (level > 0.5) and (level <= 2.9):
        own['Recoil_Section'] = 2

    if (level > 2.9) and (level <= 4.9):
        own['Recoil_Section'] = 3

    if (level > 4.9) and (level <= 9.9):
        own['Recoil_Section'] = 4

    if (level > 9.9) and (level <= 19.9):
        own['Recoil_Section'] = 5

    if (level > 19.9):
        own['Recoil_Section'] = 6

cont = logic.getCurrentController()      
property(cont)

Everytime I run this script, the console says the following "No module named 'bge'," why is this happening and how can I fix it? Any help is appreciated. Thanks!

$\endgroup$

Browse other questions tagged or ask your own question.