i want to do something very simple, have a reticle which changes colour depending on whether it is over an enemy or friend, i have string properties on each object both named “type” and one with a value of “enemy” and the other with “friend” i can access the objects through this script but i cant seem to access the properties on the objects:
import bge
def detect():
cont = bge.logic.getCurrentController()
own = cont.owner
ray = cont.sensors["Ray"]
target = ray.hitObject
scene = bge.logic.getCurrentScene()
cube = scene.objects["Cube"]
if ray.positive and target ["type"] == friend:
cube.color = [0,1,0,True]
else:
cube.color = [0.8,0.8,0.8,True]
if ray.positive and target ["type"] == enemy:
cube.color = [1,0,0,True]
detect()
any help appreciated