I have a game which is a car moving forward on pressing the up arrow and stops on pressing the down arrow. I need to change the game control. I want to use a matlab file as input.
This file contains a function, when the function = 1 car moves when it's 0 the car stops.
import bge cont = bge.logic.getCurrentController() own = cont.owner move = cont.actuators["move"] pressup = cont.sensors["up"] pressdown = cont.sensors["down"] speed = move.dLoc if pressup.positive: speed = speed + 0.05 move.dLoc = [0.0, speed, 0.0] cont.activate(move) elif pressdown.positive: speed = 0 cont.deactivate(move) move.dLoc = [0.0, 0.0, 0.0]