Godot simple walk jump
Fri Jan 19 2024 02:39:49 GMT+0000 (Coordinated Universal Time)
Saved by
@Hammy711
extends CharacterBody2D
const SPEED = 180
const JUMPFORCE = -950
const GRAVITY = 40
func _physics_process(delta):
if Input.is_action_pressed("right"):
velocity.x = SPEED
if Input.is_action_pressed("left"):
velocity.x = -SPEED
if Input.is_action_just_pressed("jump") and is_on_floor():
velocity.y = JUMPFORCE
velocity.y += GRAVITY
move_and_slide()
velocity.x = lerp(velocity.x, 0.0, 0.1)
content_copyCOPY
https://www.youtube.com/watch?v=TrX6WCu5VNc
Comments