You need to climb 2 ropes then give him raccoon flying power. When the mario is flying above the red door give him cape power. If timed correctly the mario will bounce off the block and still press the button. It requires some timing.
Looks and plays a lot like the classic game I had on MSX i think it was called Traffic. It's fun but I didn't get the hang of it with all the powerups and such.