Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | fznx132 |
so I wrote in my button script so that the character can run like this:
extends KinematicBody2D
const speed = 500
var jump = 1000
var gravity = 1100
var vel = Vector2(0,0)
func _physics_process(delta):
if $right.pressed:
vel.x = speed
move_and_slide(vel)
vel.x = lerp(vel.x, 0,0.2)
but if I run this script the character will run by itself
guess what’s my mistake?