For Mario, well, he had these enemies called boos, if I'm not mistaken...
When you see them , the hide, but when you turn away, they attack...
Sonic, however, has something more rellevant to what you're talking about...
If he sees and enemy on screen and you press the jumping button twice,
he charges at it...
For my sonic game, I've altered that- ( I was too lazy to figure out how to do that at the time)
It's a sonic game fused with a mario game. I can figure out how to do the boos... but....
I might need some tips on that "sonic charging thing" I stated earlier.
Or... am I posting this in the wrong topic?