Sign in to follow this  

Creating a Pacman game in C#/Winforms

This topic is 682 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

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

This topic is 682 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this