       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
+      if groups[entBlob.group]
+        groups[entBlob.group] -= delta
+        if groups[entBlob.group] < 0
+          groups[entBlob.group] = null
       entObj =
         x: entPos.x - entPos.radius
         y: entPos.y - entPos.radius

  .c 'blob',
    velX: velX + entBlob.velX
    velY: velY + entBlob.velY
    parent: @entity.id
    parentTime: 20000
    weightCap: weight
    weight: 1
  .c 'render', @entity.c 'render'
  entBlob.weightCap = weight
  entBlob.velX = -velX
  entBlob.velY = -velY
  @result = newEntity.id

module.exports = 

Action = require('ecstasy').Action
QuadTree = require('simple-quadtree')

_groupId = 0
groups = {}

class BlobComponent
  constructor: ({@velX, @velY, @group, @parent, @weight, @weightCap, @invincible}) ->
    @velX ?= 0
    @velY ?= 0
    @weight ?= 0.15
    @group ?= _groupId++

square = (x) -> x * x

