That being said, as long as you don't profit in any way from it, most companies are okay with fanart, which includes fangames, and they are even okay with you reusing their assets most of the time.
Capcom, for exapmle, is pretty swell with it, and their position is something along the lines of "we are not legally allowed to support you in any way, but we're not going to do anything to stop you either, so go ahead". Because of that general attitude, a project like Mega Man X: Corrupted, which has a scale on the same level as an official game, if not more, can be made without any problems. (And seriously check it out. That's a game with TONS of potential.)
There is even an entire site dedicated to Sonic fangames. I'm pretty sure Sega is aware of it. If they had any problem, they'd have already sent a C&D.
So yeah, if you want to make a sort of tribute to somethign, your fanwork should be okay, as long as you know which lines you aren't allowed to cross.