var gamedata = {
- load: function(def) {
- if (this[def]) return this[def];
- else return this[def] = new Textfile(def);
- }
+ load: def => this[def] ? this[def] : this[def] = new Textfile(def)
}
var gfx = {
load: function(def) {
- if (this[def]) return this[def];
- else {
+ if (!this[def]) {
this[def] = document.createElement("img");
this[def].setAttribute("src", def);
- return this[def];
}
+ return this[def];
}
};
f[2], f[3]);
}
- this.block = function() { this.animate("block" ); return this; };
- this.cast = function() { this.animate("cast" ); return this; };
- this.die = function() { this.animate("die" ); return this; };
- this.hit = function() { this.animate("hit" ); return this; };
- this.run = function() { this.animate("run" ); return this; };
- this.shoot = function() { this.animate("shoot" ); return this; };
- this.stance = function() { this.animate("stance"); return this; };
- this.swing = function() { this.animate("swing" ); return this; };
+ this.block = () => this.animate("block" );
+ this.cast = () => this.animate("cast" );
+ this.die = () => this.animate("die" );
+ this.hit = () => this.animate("hit" );
+ this.run = () => this.animate("run" );
+ this.shoot = () => this.animate("shoot" );
+ this.stance = () => this.animate("stance");
+ this.swing = () => this.animate("swing" );
}
function Hero(gender = "female", hair = "short"){
return this;
}
- this.block = function() { this.animate("block" ); return this; };
- this.cast = function() { this.animate("cast" ); return this; };
- this.die = function() { this.animate("die" ); return this; };
- this.hit = function() { this.animate("hit" ); return this; };
- this.run = function() { this.animate("run" ); return this; };
- this.shoot = function() { this.animate("shoot" ); return this; };
- this.stance = function() { this.animate("stance"); return this; };
- this.swing = function() { this.animate("swing" ); return this; };
+ this.block = () => this.animate("block" );
+ this.cast = () => this.animate("cast" );
+ this.die = () => this.animate("die" );
+ this.hit = () => this.animate("hit" );
+ this.run = () => this.animate("run" );
+ this.shoot = () => this.animate("shoot" );
+ this.stance = () => this.animate("stance");
+ this.swing = () => this.animate("swing" );
}
function Controls(hero, map){