Hi. Im having a problem… been doing a tutorial on youtube. All was fine 'till the end of it when i keep getting this error.
“IndentationError: expected an indented block
Python script error - object ‘gameCamera’, controller ‘Python’:
Traceback (most recent call last):
File “main.py”, line 2, in <module>
SystemError: <built-in function bpy_import_meth> returned NULL without setting an error
Blender Game Engine Finished”
have checked the code several times and cant see whats wrong. So i was something a couple of extra eyes could figure it out
here is the script
import bge
def create_object(position, square):
scene = bge.logic.getCurrentScene()
cont = bge.logic.getCurrentController()
own = cont.owner
turn = own [“turn”]
if turn == 0:
bge.logic.globalDict["field"] = ['0', '0', '0', '0', '0', '0', '0', '0', '0']
field = bge.logic.globalDict["field"]
if turn % 2 == 1:
object = "cross"
symbol = 'x'
else:
object = "circle"
symbol = 'o'
if field[square] == '0':
object = scene.addObject(object, "grid", 0)
object.localPosition = position
own["turn"] = turn +1
bge.logic.globalDict["field"][square] = symbol
print ('object_created')
return
def check_for_win(square):
cont = bge.logic.getCurrentController()
own = cont.owner
field = bge.logic.globalDict["field"]
check_col = square % 3
check_row = int (square / 3) * 3
if field[check_col] == field [check_col + 3] and field[check_col] == field[check_col + 6]:
return "winner_"+field[check_col]
if field[check_row] == field[check_row + 1] and field[check_row] == field [check_row + 2]:
return "winner_"+field[check_row]
if square % 2 == 0:
if field[0] == field[4] and field[0] == field[8]:
return "winner_"+field[square]
if field[2] == field[4] and field[2] == field[6]:
return "winner_"+field[square]
if own["turn"] == 8:
return "draw"
return "None"