To get some practice with SpriteKit, entities and components I built a little demo.
I created a
SKNode subclass (
IsometricMapNode) which renders an isometric map. It does so by adding
TileSpriteNode) subclasses to itself.
The data of the map is stored in a platform agnostic class
IsometricMap which manages
Tile objects. The map can do things like loading a TMX file and generate tiles which carry information (type of tile, texture name, ...).
The map is then passed to aforementioned
IsometricMapNode and displayed.
All is working fine but then I read about
GKEntity and I wonder if I can introduce the concept of entities into my code. I was wondering if every tile in my map should be an entity which would then get a render component and maybe a physics component or a particle component.
What I don't understand though: Would my model class
Tile become a
GKEntity, or its visual cousin
TileSpriteNode? Or is it just philosophical?
Tile is the entity, users of my map would add new entities to it, hopefully with a render component attached to them.
If I keep my
Tile model class, the map would internally create entities from this class, add some standard components (mainly rendering) and allow the user to change those components later.
Is this making sense at all? :-)