4

I've currently been using my own entity system for a game I'm working on, but I just learned about Gameplaykits usage of skentity and skcomponent.

It seems like a good design pattern and I want to learn how to use it. I have been following this tutorial so far:

https://www.raywenderlich.com/155780/gameplaykit-tutorial-entity-component-system-agents-goals-behaviors-2

It is pretty detailed in how to use it, but I'm wondering if instead of creating the entity in the Gamescene.swift file, can I do this within the editor?

Currently I'm subclassing most game elements, so I can create it in the editor and the subclass does all the work. No need to instantiate it from the scene files. But going through this tutorial, it seems that you have to do it this way, or at least I'm not aware of how I can do it. Can I subclass it to an SKEntity file in the editor?

If anyone has any answers, I would love to hear them. Thanks for any help!!!

Discoveringmypath
  • 1,049
  • 9
  • 23
  • entities are created automatically when you add components.. entities are not sprites... entities have sprite components – Fluidity Sep 24 '17 at 12:35
  • How do I make an entity and then tell the sprite in the editor it belongs to this entity type. Lastly, I would need to add additional components within the editor, so I'm curious how this is done. – Discoveringmypath Sep 24 '17 at 14:13
  • 1
    I can subclass a skspritenode to be a "coin" for example. In the editor I can then add in the coin and tell that sprite it is my Coin subclass. Then in the Coin.swift subclass file I can create an entity of Coin, and assign a bunch of components to it. How do I add components to this coin sprite in the editor though? I've been playing around with it, and can't seem to figure out how to do it... – Discoveringmypath Sep 24 '17 at 14:23
  • i think u have to declare entities program-ally... you could put a user data + component that reads it to auto-add to an entity property in the scene perhaps. these are the types of reasons (limitations) i never bothered with editor... – Fluidity Sep 24 '17 at 14:59
  • 1
    The last tab on the right hand menu is for components – Knight0fDragon Sep 25 '17 at 13:45
  • If you are using the editor, you should not have to create entities, the editor does it all for you. – Knight0fDragon Sep 25 '17 at 13:46
  • Thank you! I think my other question answered this for me... – Discoveringmypath Sep 25 '17 at 16:38

0 Answers0