the GDScript Docs code in the physics introduction has 2 errors how do i fix it ?

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

in Physics introduction — Godot Engine (stable) documentation in English

the last code on that page:

`
extends CharacterBody2D

var run_speed = 350
var jump_speed = -1000
var gravity = 2500

var velocity = Vector2()

func get_input():
velocity.x = 0
var right = Input.is_action_pressed(‘ui_right’)
var left = Input.is_action_pressed(‘ui_left’)
var jump = Input.is_action_just_pressed(‘ui_select’)

if is_on_floor() and jump:
    velocity.y = jump_speed
if right:
    velocity.x += run_speed
if left:
    velocity.x -= run_speed

func _physics_process(delta):
velocity.y += gravity * delta
get_input()
velocity = move_and_slide(velocity, Vector2(0, -1))
`

gives me 2 errors, the first one says:
Line 7: Member “velocity” redefined (original in native class ‘CharacterBody2D’)

and the second one says:
Line 25: Too many arguments for “move_and_slide()” call. Expected at most 0 but received 2

btw line 7 is “var velocity = Vector2()” and line 25 is “velocity = move_and_slide(velocity, Vector2(0, -1))”

:bust_in_silhouette: Reply From: exuin

I already fixed this, the change just needs to be cherrypicked. Removed all instances of velocity being defined for `CharacterBody2D` by ShatReal · Pull Request #6862 · godotengine/godot-docs · GitHub