         'green': 255
         'blue': 255
         'alpha': 1
-    @children = new Pool
     @i = 0
 
   ###
    * @description Draw child objects
    * @param {CanvasRenderingContext2D} context
   ###
-  draw: (context, offsetX, offsetY) ->
-    return if not @active
-
-    offsetX = offsetX || 0
-    offsetY = offsetY || 0
+  draw: (context, offsetX = 0, offsetY = 0) ->
+    return if @children is undefined
 
     @i = @children.length
     while @i--

Pool = require './pool.coffee'

class GameObject
  constructor: (x, y) ->
    @position =
        'x': x || 0
        'y': y || 0

    @active = true
    @fixed = false     # static positioning for UI elements
    @scale = 1
    @rotation = 0

   * @param {Shape} object
  ###
  add: (object) ->
    @children = new Pool() if @children is undefined # be lazy

    @children.add object
    object.parent = this

  ###
   @description Clean up child objects
  ###
  destroy: ->
    return if @children is undefined

    @i = @children.length
    while @i--
      @children.at(@i).destroy() if typeof @children.at(@i).destroy is 'function'

  ###
   @description Getter/setter for color value
  ###
  @property 'color',
    get: ->
