 Action = require('ecstasy').Action
 QuadTree = require('simple-quadtree')
 
+_groupId = 0
+groups = {}
+
 class BlobComponent
-  constructor: ({@velX, @velY, @parent, @parentTime, @weight, @weightCap, @invincible}) ->
+  constructor: ({@velX, @velY, @group, @parent, @weight, @weightCap, @invincible}) ->
     @velX ?= 0
     @velY ?= 0
     @weight ?= 0.15
+    @group ?= _groupId++
 
 square = (x) -> x * x
 

      if entBlob.invincible
        entBlob.invincible -= delta
        entBlob.invincible = null if entBlob.invincible < 0
      if entBlob.parentTime
        entBlob.parentTime -= delta
        if entBlob.parentTime < 0
          entBlob.parentTime = null
          entBlob.parent = null
      entObj =
        x: entPos.x - entPos.radius
        y: entPos.y - entPos.radius

        return if other == entity
        [otherPos, otherBlob] = [other.c('pos'), other.c('blob')]
        return if otherBlob.weightCap
        if entBlob.group == otherBlob.group
          if groups[entBlob.group]
            pushOther entity, other if entPos.collides otherPos
            return
        return if otherBlob.weight <= 0.1
        return if entBlob.invincible
        return if otherBlob.invincible
