Can somebody guide me making class hierarchy for pacman... how much class should i make.. n which objects..?? Please help me.. m not so much familiar with Game Programming...
You should probably read a book to learn enough about game heirarchies. At the very least though you'll need: a pure virtual class from which your world entities derive (player, each type of enemy, perhaps strawberry etc) and of course a class for each of these entities. A world class which handles all of your entities and monitors and updates their states, a game class, a graphics class to handle all drawing and a sound class.
This could be a huge post there's so much that could be said. Do you have any more specific questions?
Then it comes down to the UI needs from there, for example a open gl canvas say on wxwidgets, Or Allegro on Dos platforms.
Game engines are generally a loop with control structures, for example each object in my scheme has a move function, one is on user controls the other is on game engine control. The Game engine handles user input on a pass of the loop for all you are doing is scanning the user inputs on a pass of the loop and react if one is there.
Thanks Guys... But, how can i manage inheritance, Composition for these classes... n please guide me to make all classes accurately n which class should inherit which?? in my thinking, there should be 6 Classes, Grid, Pacman, Ghost, Food, Time, Score.. now i need some help that which class should be base n which should be derived.. n these classes should have which entities.. n should i first make a simple game without graphics or should i directly work on graphics..??
Actually OO design is pretty subjective. There is a hierarchy of cuz but then how detailed or generic is up to the developer when he do his design. Please keep the hierarchy simple cuz I have seen up to 7 level for a simple game. That to me is an overkill :)