You will start out as Yoshi. The guy flying on a cloud (I don't think his name was ever mentioned in the game) tells you to get a key that a rabbit stole to get into the castle. Once done you get into the castle. Once in, you may explore the accessible places in the castle. You may become Mario after u acquire 8 stars. You must enter a painting in the Rec room and defeat Goomboss. To get luigi you must go to The place accessed by killing a boo in the courtyard just jump in when your on levels 3-7 go and defeat King Boo. When your luigi go to the second snow room get 1 of the flowers and walk through the mirror then go to Wario's painting and beat the boss there. You need more keys to access the basement, the attic and the whole 2nd floor, which are only accessed from doors that require keys gotten from Bowser. The first key is gotten from Bowser in the first area after acquiring 12 stars. Once beaten you get the key that allows you to get to the basement. Then you need to acquire 30 stars and go beat Bowser for the second time, get the second key. Then you go to the 2nd floor, and acquire 70 stars to get to Bowser the last and final time. The only difference when you beat him this time is that instead of a key you get a giant star, and once you take the star Mario will gain his flight ability and fly all the way to the castle meet up with Yoshi, Wario, and Luigi. Peach will start to thank them. She kisses Mario on the nose, and tells them they get a cake for saving her life.
Hints
There is a cannon that you can use to get on top of the castle and get any character's ability once u have 150 stars.