Some thoughts about refactoring

Some thoughts about refactoring

Postby Edward_Lii » 15 Feb 2013, 17:35

Hello all,

There are two things that are bothering me and I think we should change them one way or another.

First of all there's the abstract super class GameObject.
At the moment they don't serve any purpose since the only type of GameObject are Blocks.
I thought about using GameObject as super class for scenery, but they have very little in common.
When scenery is implemented it will probably be kept in a separate vector than the blocks anyway, because why would we iterate through the scenery every frame for collision detection?

My suggestion is to either remove them, or keep them, but change the levelObjects array to hold Block pointers.
The latter is probably best since the leveleditor can handle scenery the same way as other blocks.

The second thing is the usage of save variables in the Player class.
IMHO they clutter the class and can easily cause bugs when missing one or more.
Wouldn't it be better to remove the save variables from the player class and keep a playerSave variable in the Game class instead?
EDIT: Looking at the Player class again, it isn't that bad actually, for some reason it felt like a lot more. :p

Suggestions and feedback are welcome. ;)
From,
Edward_Lii
User avatar
Edward_Lii
MnMS Moderator
 
Posts: 777
Joined: 20 Dec 2010, 16:46

Re: Some thoughts about refactoring

Postby acme_pjz » 16 Feb 2013, 15:01

Edward_Lii {l Wrote}:My suggestion is to either remove them, or keep them, but change the levelObjects array to hold Block pointers.
The latter is probably best since the leveleditor can handle scenery the same way as other blocks.


I agree.

As for the player class I'm not sure :|
Some of my open source games on GitHub
User avatar
acme_pjz
 
Posts: 547
Joined: 10 Dec 2009, 15:32
Location: PeeKing, China

Who is online

Users browsing this forum: No registered users and 1 guest