I’m fairly new to blender. My teacher wants me to code in the text editor instead of using the more visual form of coding in the logic editor. I want to use an always sensor that connects to a motion-making script, which is connected to a motion actuator. It works fine, except my player moves without me pressing down the W key. My problem is finding the right code to say “If you are pressing down the W key, THEN you walk forward.”
Here’s my code:
import bge
cont = bge.logic.getCurrentController()
own = cont.owner
move = cont.actuators[“Motion”]
pressup = cont.sensors[“Always”]
if bge.events.WKEY: #The problem is on this line
move.dLoc = [0.0, .05, 0.0]
cont.activate(move)