VampireSurvivor/mob.gd

11 lines
295 B
GDScript

extends CharacterBody2D
const SPEED = 100
@onready var player = get_node("/root/Game/Player")
func _physics_process(_delta: float) -> void:
if not player: return
var direction = global_position.direction_to(player.global_position)
velocity = direction * SPEED
move_and_slide()