13 lines
313 B
GDScript
13 lines
313 B
GDScript
class_name NPCCharacter extends CharacterBody2D
|
|
|
|
func _physics_process(delta: float) -> void:
|
|
if not is_on_floor():
|
|
velocity+=get_gravity() * delta
|
|
|
|
move_and_slide()
|
|
|
|
func knockBack(direction,duration:float=0.2):
|
|
velocity =direction
|
|
await get_tree().create_timer(duration).timeout
|
|
velocity =Vector2.ZERO
|