Pellet = class(Object, function(o, x, y, w, h)
  Object.init(o, x, y, vgridSize/2, hgridSize/2)
  o.scale = 0
  o.alpha = 255;
  Tweener:addTween(o, {scale=0.5}, {func="inOutElastic", time=0.9}) 
  o.age = 0
end)
function Pellet:draw()
  sheet:addCenteredTile(sprites["Gem Blue.png"], self.pos.x+hgridSize*.75, self.pos.y-vgridSize+vgridSize, 1, 0, self.scale, 255, 255, 255, self.alpha)
end
function Pellet:kill()
  self.alive = false
  Tweener:addTween(self, {scale=1.5, alpha=0}, {func="outExpo", time=1.2, onComplete=function()
    mainState.pellets:remove(self)
  end})
end
function Pellet:kill2()
  self.alive = false
  Tweener:addTween(self, {scale=0, alpha=0}, {func="outExpo", time=1.2, onComplete=function()
    mainState.pellets:remove(self)
  end})
end
function Pellet:sync()
  self.age = self.age + 1
  if self.age > 6 then
    self:kill2()
  end
end