–2 votes

he is not moving when i press the buttions. project settings are checked and updated so things should happen when i press the buttions but they dont.


extends KinematicBody

var MOVESPEED = 14
const JUMP
FORCE = 30
const GRAVITY = 0.98
const MAXFALLSPEED = 30
const HLOOKSENS = 1.0
const VLOOKSENS = 1.0
onready var cam = $Spatial/Cambase
onready var anim = $Graphics
var y
velo
var onground = true
var has
double_jumped

func ready():
#anim.getanimation("walk").setloop(true)
Input.setmousemode(Input.MOUSEMODECAPTURED)

func input(event):
if event is InputEventMouseMotion:
_cam.rotation
degrees.x -= event.relative.y * VLOOKSENS
cam.rotationdegrees.x = clamp(cam.rotationdegrees.x, -90, 90)
rotationdegrees.y -= event.relative.x * HLOOK_SENS

func physicsprocess(delta):
var movevec = Vector3(1, 1, 1)
if Input.is
actionpressed("moveforwards"):
movevec.z -= MOVESPEED
if Input.isactionpressed("movebackwards"):
move
vec.z += MOVESPEED
if Input.is
actionpressed("moveright"):
movevec.x += MOVESPEED
if Input.isactionpressed("moveleft"):
move
vec.x -= MOVESPEED
move
vec = movevec.normalized()
move
vec = movevec.rotated(Vector3(0, 1, 0), rotation.y)
move
vec = MOVE_SPEED

var grounded = is_on_floor()
var y_velo = GRAVITY
var just_jumped = false
if Input.is_action_just_pressed("jump"):
    just_jumped = true
    y_velo = JUMP_FORCE 
    if just_jumped == true and has_double_jumped == false:
        y_velo = JUMP_FORCE
        has_double_jumped = true

if grounded and y_velo <= 0:
    y_velo = -0.1
if y_velo < -MAX_FALL_SPEED:
    y_velo = -MAX_FALL_SPEED

func play_anim():
pass
`

Godot version 3.2.3
in Engine by (15 points)

1 Answer

0 votes

Have you set up your input names in InputMap ?
Follow the below tutorial:
https://youtu.be/ngHbAmN062c

by (106 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.