The apply_central_impulse()
method takes a vector that's used as the direction of the applied force. So, really, you just want that vector to represent the direction your ship is facing. You can get that from the ship's rotation
property.
So, assuming your ship is facing to the right at it's zero orientation, something like this should work (wired to a button in this case):
func _on_ButtonForward_pressed():
var impulse_strength = 100
var angle = $RigidBody2D.rotation
$RigidBody2D.apply_central_impulse(Vector2(cos(angle), sin(angle)) * impuse_strength)
Just season to taste...