21 lines
361 B
GDScript
21 lines
361 B
GDScript
extends CharacterBody2D
|
|
|
|
|
|
var direction = Vector2.LEFT
|
|
@export var speed = 6# pixels / s
|
|
@export var damage = 4
|
|
|
|
|
|
func _physics_process(delta):
|
|
var mover = move_and_collide(direction * speed)
|
|
|
|
|
|
|
|
func _on_visible_on_screen_notifier_2d_screen_exited():
|
|
queue_free()
|
|
|
|
func _on_area_2d_body_entered(body):
|
|
if not body.name == "plr":
|
|
body.die()
|
|
queue_free()
|