Jump to content
  • Advertisement
Sign in to follow this  
Fauch

Creating a Pacman game in C#/Winforms

This topic is 990 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello all,

 

take care, this is an absolute beginners question:

 

I'm making a Pacman game in C#/Winforms. I have set up my board as an array of GameObjects. GameObject is an abstract class, and has two derived classes: GameSpace and GameWall. 

 

So far, so good. What I'm unsure of is how to move my Player across the board. Should Player be another class derived from GameObject, and should I renitialize the array field where player leaves? Or should "bool hasPlayer" be an attribute of GameSpace?

 

Any input appreciated :) 

Share this post


Link to post
Share on other sites
Advertisement

I'd personally recommend separating tiles (wall and space as you mentioned) and entities. The 'world' is made out of tiles and entities reside on top of one or several tiles (depending how you handle movement). You could then define an Entity base class which all entities inherit (be it an AI mob, player or whatever). The entity class would contain the location and move logic so you only have to write it once.

 

The exact implementation depends on how you want the movement to work. If you just jump entities from one tile to another it's much simpler, but visually less attractive.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!