13 lines
284 B
GDScript
13 lines
284 B
GDScript
extends CharacterBody2D
|
|
|
|
@export var speed = 50
|
|
@export var gravity = 50
|
|
|
|
func get_input():
|
|
var input_direction = Input.get_axis("player_left", "player_right")
|
|
velocity.x = input_direction * speed
|
|
|
|
func _physics_process(delta):
|
|
get_input()
|
|
velocity.y += gravity
|
|
move_and_slide()
|