How come I can't move my character in one world but not in the other even though the code is the same

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Kanon

So I have a project that uses some movement code, and I have three “worlds” so far, the scrapyard, the garage, and one that’s just a player file that I can copy paste onto the other worlds. The movement works in the player world and the garage, but not in the scrapyard, even though the code is the same. Is there some kind of world setting that I might have activated that prevents the code from functioning? It’s 2D btw.

:bust_in_silhouette: Reply From: mohamedLT

can you post your code here so we can have better understanding of the problem

:bust_in_silhouette: Reply From: Kanon

Here’s my code, know of any settings or requirements that this depends on which could have been deleted/disabled? I put ;s at the end of it so that it can be read, it’s not like that in the code, it’s just how the text compiles in this answer, and I don’t know why there is a box around the text at the bottom.


extends KinematicBody2D ;

const ACCELARATION = 400 ;
const MAX_SPEED = 48000 ;
const FRICTION = 1200 ;

var velocity = Vector2.ZERO ;

onready var animationPlayer = $AnimationPlayer ;
onready var animationTree = $AnimationTree ;

func _physics_process(delta): ;
var input_vector = Vector2.ZERO ;
input_vector.x = Input.get_action_strength(“ui_right”) - Input.get_action_strength(“ui_left”) ;
input_vector.y = Input.get_action_strength(“ui_down”) - Input.get_action_strength(“ui_up”) ;
input_vector = input_vector.normalized() ;

if input_vector != Vector2.ZERO: ;
	animationTree.set("parameters/Movement/blend_position", input_vector) ;
	velocity = velocity.move_toward(input_vector * MAX_SPEED, ACCELARATION * delta) ;
else: ;
	velocity = velocity.move_toward(Vector2.ZERO, FRICTION * delta) ;

velocity = move_and_slide(velocity) ;