CyberTower/scripts/bullet.gd
2024-02-16 20:35:30 +08:00

16 lines
302 B
GDScript

extends CharacterBody2D
@export var damage = 12.0
func _physics_process(delta):
var collision = move_and_collide(velocity * delta)
if collision:
var collider = collision.get_collider()
if collider is Enemy:
collider.take_damage(damage)
queue_free()
func _on_timed_out():
queue_free()