I am developing a top down 'thing' in SFML and C++ and was wondering about how best to handle so called Entities in my game.
An entity, for example is defined by me as an object ingamein-game, such as a door to a house, that can be interacted with, can be animated, can act on user input, can be affected by physics etc.
I was thinking of handling this system by a series of classes and subclasses, for example. The
For example, the base class of Entity would contain the methods RenderRender, UpdateUpdate, HandleInputHandleInput and such as these are the most basic methods that all entities will contain. Variables of the main class could include isVisibleisVisible, isPhysicalisPhysical, drawDepthdrawDepth and so on.
A new class for MapObjectMapObject would use inheritance to take the methods from Entity and may also add other methods and variables such as tileTexturetileTexture, tileHeighttileHeight and tileWidthtileWidth.
Abstracting(?) from that again could be the DoorTileDoorTile class which would handle the item specific level of input handling and interaction.
Is this a valid way to handle objects ingamein-game? Are there and glaring errors?(Bear in mind I've been awake for many many hours :p)
Sorry if this is somewhat longwindedlong-winded, I wanted to be specific as to how my proposed system would work
Thanks
JD.