I… think you solved then? Fix the indentation and it will work. Dealing with sintax is part of the pain of programming, programming languages are very primitive tools.
Well, as a matter of fact it not unusual at all to have something with no error and still not working, welcome to world of dynamic languages :D. Let’s say that the code is properly indented:
import bge
cont = bge.logic.getCurrentController()
scene = bge.logic.getCurrentScene()
mouse = cont.sensors["Mouse"]
mouseover = controller.sensors["Mouseover"]
hitpos = mouseover.hitPosition
if mouse.positive and mouseover.positive:
actuator = co.actuators["billy"]
cont.activate(actuator)
It makes sense, you get it right, this should work from a code perspective. If it doesn’t you have to check the “hidden” conditions, like:
is “billy” the right name of the actuator? I mouse.positive True? Is mouseover.positive True?
If that’s true, does actuator actually do something?
Without a step debugger you have to check things with “print”, like in:
mouse.positive = True
mouseover.positive = True
billy actuator = something that looks like an actuator
before to call an exorcist for your PC try to check if the actuator, when active, actually does what it should (by manually setting a fake, always true condition that activates it)
By the way, this kind of struggling is absolutely normal when dealing with a new API and/or tool set. Things will flow smoother as long as you keep practicing with it.
Yeah, the code was wrong. Names, wrong names (co, controller, cont are all supposed to be same thing, i used controller, indentation was also a bit off). Below the working code.
import bge
controller = bge.logic.getCurrentController()
scene = bge.logic.getCurrentScene()
mouse = controller.sensors["Mouse"]
mouseover = controller.sensors["Mouseover"]
hitpos = mouseover.hitPosition
if mouse.positive and mouseover.positive:
actuator = controller.actuators["billy"]
controller.activate("billy")