"Beast" and "Player" now inherit from "Creature".
This commit is contained in:
parent
528c2cbff3
commit
ee680009ef
2 changed files with 22 additions and 19 deletions
33
src/jsds.js
33
src/jsds.js
|
@ -1,14 +1,11 @@
|
||||||
{
|
{
|
||||||
function Player(info,attributes,properties,drawinfo){ // x,y,w,h,col) {
|
function Creature(info,attributes,properties,drawinfo){
|
||||||
/* info: pname, cname,class, level, experience, race, size
|
/* info: pname, cname,class, level, experience, race, size
|
||||||
* attributes: body, agility, spirit
|
* attributes: body, agility, spirit
|
||||||
* properties: strength, hardness, movement, skill, mind, aura
|
* properties: strength, hardness, movement, skill, mind, aura
|
||||||
* drawinfo: x,y,w,h,col
|
* drawinfo: x,y,w,h,col
|
||||||
*/
|
*/
|
||||||
|
this.info = {"pname": info["pname"]+"", "experience": info["experience"]*1, "race":info["race"]+"",
|
||||||
// player.push(Crafty.e("Creature").player(x,y,w,h,col);
|
|
||||||
this.info = {"pname": info["pname"]+"", "cname": info["cname"]+"", "class": info["class"]+"",
|
|
||||||
"level": info["level"]*1, "experience": info["experience"]*1, "race":info["race"]+"",
|
|
||||||
"size":info["size"]*1};
|
"size":info["size"]*1};
|
||||||
this.attributes = {"body": attributes["body"]*1, "agility": attributes["agility"]*1,
|
this.attributes = {"body": attributes["body"]*1, "agility": attributes["agility"]*1,
|
||||||
"spirit": attributes["spirit"]*1};
|
"spirit": attributes["spirit"]*1};
|
||||||
|
@ -18,6 +15,21 @@
|
||||||
|
|
||||||
this.graphelement = Crafty.e("Creature").creature(this.info["pname"],drawinfo["x"],drawinfo["y"],drawinfo["w"],
|
this.graphelement = Crafty.e("Creature").creature(this.info["pname"],drawinfo["x"],drawinfo["y"],drawinfo["w"],
|
||||||
drawinfo["h"],drawinfo["col"]);
|
drawinfo["h"],drawinfo["col"]);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
function Player(info,attributes,properties,drawinfo){ // x,y,w,h,col) {
|
||||||
|
/* info: pname, cname,class, level, experience, race, size
|
||||||
|
* attributes: body, agility, spirit
|
||||||
|
* properties: strength, hardness, movement, skill, mind, aura
|
||||||
|
* drawinfo: x,y,w,h,col
|
||||||
|
*/
|
||||||
|
|
||||||
|
Creature.apply(this, arguments);
|
||||||
|
this.info["cname"]= info["cname"]+"";
|
||||||
|
this.info["class"]= info["class"]+"";
|
||||||
|
this.info["level"]= info["level"]*1;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Player.prototype.printoutput = function() {
|
Player.prototype.printoutput = function() {
|
||||||
|
@ -32,16 +44,7 @@
|
||||||
* drawinfo: x,y,w,h,col
|
* drawinfo: x,y,w,h,col
|
||||||
*/
|
*/
|
||||||
|
|
||||||
this.info = {"pname": info["pname"]+"", "experience": info["experience"]*1, "race":info["race"]+"",
|
Creature.apply(this,arguments);
|
||||||
"size":info["size"]*1};
|
|
||||||
this.attributes = {"body": attributes["body"]*1, "agility": attributes["agility"]*1,
|
|
||||||
"spirit": attributes["spirit"]*1};
|
|
||||||
this.properties = {"strength": properties["strength"]*1 , "hardness": info["hardness"]*1,
|
|
||||||
"movement": info["movement"]*1, "skill": properties["skill"]*1,
|
|
||||||
"mind": properties["mind"]*1, "aura": properties["aura"]*1};
|
|
||||||
|
|
||||||
this.graphelement = Crafty.e("Creature").creature(this.info["pname"],drawinfo["x"],drawinfo["y"],drawinfo["w"],
|
|
||||||
drawinfo["h"],drawinfo["col"]);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Beast.prototype.printoutput = function() {
|
Beast.prototype.printoutput = function() {
|
||||||
|
|
|
@ -78,8 +78,8 @@
|
||||||
this.enableControl();
|
this.enableControl();
|
||||||
};
|
};
|
||||||
/* if(e.mouseButton === Crafty.mouseButtons.RIGHT) {
|
/* if(e.mouseButton === Crafty.mouseButtons.RIGHT) {
|
||||||
cur_sel.attack(player[this.id]);
|
cur_sel.attack(player[this.id]);*/
|
||||||
};*/
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
Loading…
Reference in a new issue