Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Immortal Arts |
Here is my code:
var curHP : int = 10
var maxHP : int = 10
var damage : int = 1
var gold : int = 0
var attackRate : float = 0.3
var lastAttackTime : int = 0
var moveSpeed : float = 5.0
var jumpForce : float = 10.0
var gravity : float = 15.0
var vel = Vector3()
onready var camera = get_node("CameraOrbit")
onready var attackCast = get_node("AttackRayCast")
func _physics_process (delta):
vel.x = 0
vel.z = 0
var input = Vector3()
if Input.is_action_pressed("move_forwards"): <--- Error
input.z += 1
if Input.is_action_pressed("move_backwards"):
input.z -= 1
if Input.is_action_pressed("move_left"):
input.x += 1
if Input.is_action_pressed("move_right"):
input.x -= 1
input = input.normalized()
vel.x = dir.x * moveSpeed
vel.y = dir.y * moveSpeed
vel.y -= gravity * delta
It says “unexpected token: “if””