extends Area2D var velocity = Vector2(0, 0) var bullet_velocity = 5 func _ready(): connect("body_enter", self, "bullet_enter_body") set_collision_mask_bit(1, false) set_fixed_process(true) func bullet_enter_body(body): if body.has_method("take_damage"): body.take_damage(1) queue_free() func bullet_left_scene(): queue_free() func set_bullet_velocity(rel, dir): velocity = rel + dir * bullet_velocity func _fixed_process(delta): translate(velocity)