I am experimenting with Haxe and OpenFL and am wondering if the Sprite
class is synonymous with a GameObject
in Unity. It seems that sprite instances have a hierarchical structure and I am wondering if this can be utilised to manage objects.
For example:
Game (Sprite / container / no visual representation)
|--> Grid (Sprite / container / no visual representation)
|--> Tile (Sprite)
|--> Tile (Sprite)
|--> ...
|--> ...
Am I correct with the above assumption, or should the Sprite
class be extended purely for objects with visual representation?
If you only need a container, you should extend
DisplayObjectContainer
. But for abstract things likeGame
, I wouldn't use aDisplayObject
at all, but custom classes.Use classes extending from
DisplayObject
only for things that should be added to the Display List. In your example,Game
shouldn't be aSprite
, butTile
andGrid
probably yes.