Page 1 of 1

Some thoughts about refactoring

PostPosted: 15 Feb 2013, 17:35
by Edward_Lii
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. ;)

Re: Some thoughts about refactoring

PostPosted: 16 Feb 2013, 15:01
by acme_pjz
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 :|