CyberTower/scripts/bullet.gd

16 lines
302 B
GDScript3
Raw Normal View History

2024-02-16 12:35:30 +00:00
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()