Whats wrong with this code ?

Hi, so i was working on my game and i put this code and its a loop end, but when i press the button to activate it keeps going and never stops. This is a 2.49 code BTW

The part of the script :

if Front.isPositive():
cont.activate(“Walk”)
#cont.deactivate(“Walk”)

I dont know why its not working properly.:frowning:

You should use code tags when you type code in, since the problem could be indentation. However, the main problem is that you can’t activate actuators by their name - you have to get to them first.



walk = cont.actuators['Walk']

if front.isPositive():
     cont.activate(walk)

you can use the actuators name (or the actuators reference).
But we need:

  • the full code (in code tags)
  • any error message from the console.

The code you show to us has the deactivation commented out. That means it gets ignored.