clowder/tscn/bullet.gd

21 lines
361 B
GDScript3
Raw Permalink Normal View History

2024-03-06 22:05:35 +01:00
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()