Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | CarlPlayz |
extends KinematicBody2D
var score : int = 0
var speed : int = 200
var jumpForce : int = 600
var gravity : int = 800
var velocity : Vector2 = Vector2()
onready var sprite : Sprite = get_node(“Sprite”)
func _physics_process(delta):
velocity.x = 0
if Input.is_action_pressed("move_left"):
velocity.x -= speed
if Input.is_action_pressed("move_right"):
velocity.x += speed
move_and_slide(velocity, Vector2.UP) #When i add velocity it changes to Unexpected token: Identifier: velocity, if there is no velocity it becomes Unexpected token: Identifier: move_and_slide