Actor = Entity:createSubClass();

function Actor:init()

   self.isActor = true;

   self.editorProperties = {
      faction = "Neutral";
   }

   self.hp = 10;

   self:setLayer(3);

end

function Actor:update()

   if self.hp < 0 then
      self:die();
   end

end

function Actor:collided(otherEnt)

   local ent = entitiesByName[otherEnt];
   if ent then
      if ent.isBullet and ent.editorProperties and not (ent.editorProperties.faction == self.editorProperties.faction) then
         self.hp = self.hp - 1;
      end
   end

end

function Actor:save()

   return { hp = hp };

end


function Actor:initFromSave(data)

   self.isActor = true;
   self.hp = data.hp;

end
