﻿function ShieldTile(col, row, size, holder)
{
   this.xPos = row * size// + holder.parent.xPos; // opaque!
   this.yPos = col * size// + holder.parent.yPos;
   this.size = size;
   this.holder = holder;
   EventCenter.addListener(this, Events.MOVE_SHIELDS, "moveShield");
   this.init();
}

ShieldTile.prototype.init = function()
{
   var t = this.tile = document.createElement('div');

   with(t.style)
   {
        zIndex = "10";
        position = "absolute";
        top = this.yPos + "px";
        left = this.xPos + "px";
        height = this.size + "px";
        width = this.size + "px";
        background = Settings.SHIELD_IMAGE || "#00FF00";
   }
   this.holder.appendChild(t);
}

ShieldTile.prototype.moveShield = function(evt)
{
   // this.xPos += evt.data;
   // this.tile.style.left = this.xPos + "px";
}

ShieldTile.prototype.die = function()
{
    this.holder.removeChild(this.tile);
    EventCenter.removeListener(this, Events.MOVE_SHIELDS, "moveShield");
}
