MarchTTLGame/scripts/npc_charector.gd

12 lines
317 B
GDScript

class_name NPCCharector 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