I haven't seen this movie in years. Its in Japanese with English sub-titles. I remember the antagonist was a robot ninja and sometime in the movie the protagonist lost either his arm or one of his eyes. Also there was a ufo that came out of nowhere in the end and saved everyone, giving him his arm back.
There was one scene where a group of ninjas snuck up on him while he was sleeping and tried stabbing him but it didn't work.