How do I change the player position through code?

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

Hi, I’m making a beat’em up game, and the player do not have the jump option, but there is a scene where she needs to jump between two builds. Until now, I’ve put an Area2D near the ledge to check if the player is in there, if it is, then he can press a button to jump, the only thing left is the code to make the player go from position A to B. How can I do it?
`extends KinematicBody2D

func _process(_delta):
#jumping
if canJump == true:
if Input.is_action_just_pressed(“ui_accept”):
sprite.play(“jump”)

func _on_JumpLedge_area_entered(area):
canJump = true

func _on_JumpLedge_area_exited(area):
canJump = false`

:bust_in_silhouette: Reply From: Cire_arievilo1

Try

Position = Vector2(0, -32)