I guess you could do something like:
If ship is overlapping sidewalls
-if ship angle is between180-360), ship set y to self.y+1
-if ship angle is between0-179), ship set y to self.y-1
The top walls would be a bit more complicated like angle= -90 to 90 set x to x+1 blah, blah blah