Any soldiers spawned before 3 seconds are stuck saying false forever, while the soldiers spawned after 3 seconds say true. Unless I am mistaken, the soldiers spawned before the 3 second mark should say true after 3 seconds.
I can confirm. The code below (which is given to us as an example of this functionality) will always say the speakerās max hp as opposed to their current this.health value.
Thanks for the code samples, guysāall that code looks like it should work, so Iāll see what I can do to fix my transpiler up for that. Is this all in Brawlwood or Dungeon Arena?
I have the same issue, and it started just after the weekend where ProtectAPI was enabled, HOWEVER, I believe the problem may be more subtle that that.
previously since this.x===undefined seemed a little iffy, I chose to do if(this.built.length===0 ) to run my āconstructorā code. however, that also broke at the same time that this.x===undefined broke.
I am afraid this is NOT fixed yet. Without persistence obtained by glomming to āthisā, its hard to write anything non-trivial. I tried in the tutorials (Dungeon Arena).
function Spawner()
{
}
Spawner.prototype.setBase = function(base){
this.builder = base;
};
Spawner.prototype.update = function(){
this.builder.build('soldier');
};
var base = this;
if(!this.spawner){
this.spawner = new Spawner();
this.spawner.setBase(base);
}
this.spawner.update();
The code above (when used inside the chooseAction() method of Base) will only generate a soldier once. Please point out if I am misunderstanding something.
Hmm, yeah, that doesnāt workāgot a bit too complex for my transpiler so far, I guess. Iām tracking it here. Will see what I can do.
Until then, if you were to add methods to this directly, it might work better. (Except donāt try to set the update method on this, because it wonāt let youāit already has one.)