
//
// Wall is the class used to instantiate the indestructible walls
// in the game. no participant can fly or walk over this unit.
//

var Wall = new Class({
	Extends: DynaObject,
	initialize: function(){
		this.parent(GAMEUNITTYPE.WALL);
		game.walls.push(this);
	},
        erase: function(){
            util.removeElementFromArray(this,game.walls);
        },
        terminate: function(){
        this.erase();
        this.parent();
        }
});

//
// Wall is the class used to instantiate the destructible walls
// in the game. a participant can fly or walk over this unit if he has passoverfakewalls goody
//

var FakeWall = new Class({
      Extends: DynaObject,
      initialize: function(){
              this.parent(GAMEUNITTYPE.FAKEWALL);
              game.fakeWalls.push(this);
              this.goody = null;
      },
    vaporate: function(){
        util.removeElementFromArray(this,game.fakeWalls);
    },
    setGoody: function(goodysubtype){
        if(goodysubtype!=null)
            this.goody = new Goody(goodysubtype); // +life , speed , passoverfakewalls , explosionLength/power
        else {
            var goodyProbability=Math.round(Math.random()*30);
              if(goodyProbability > 18){
           		this.goody = new Goody(null); // +life , speed , passoverfakewalls , explosionLength/power
              }
        }
    },
    terminate: function(){
        this.vaporate();
        this.parent();
        this.leaveGoodyBehind();
    },
    leaveGoodyBehind: function(){
    	if(this.goody!=null){
    		this.goody.appear(this.myZone);
    	}
    }
});
