import bge
from bge import logic
#the script is applied to a player
cont = logic.getCurrentController()
own = cont.owner
scene = logic.getCurrentScene()
obj = scene.objects
#this is ray sensor: -Y 1.5 distance from player(in front of him), X-Ray is off
ray = cont.sensors["ray"]
space_key = bge.logic.KX_INPUT_ACTIVE == keyboard.events[bge.events.SPACEKEY]
hitObj = ray.hitObject
door1 = obj["door1"]
if hitObj == obj["door1"]:
if own["key1"] == 1:
if space_key and door1["open"] == 0:
door1["open"] = 10
elif space_key and door1["open"] == 10:
door1["open"] = 0
The doors has action applied to it with 10 frames reading data from property “open”, it works - I tested. However, this script doesn’t set te property correctly. What could be the problem?