You can calculate a normal a normal (length 1) Vector2, and multiply it by the wished length. That would give you:
var normalized = (get_local_mouse_position() - hero.position).normalized()
var target = hero.position + normalized * length
drawline(hero.position, length, Color(255, 0, 0, 0.5), 3, true)
For your projectiles, if you have speed in distance/time, lifetime a,d want to calculate distance, just multiply speed with lifetime. You may be off by a constant factor depending on units mismatch, notably if speed is in distance/tick length. Try multiplying/divinding by delta.