First basic 'adventure', added creature
This commit is contained in:
parent
8ee25d51cf
commit
528c2cbff3
3 changed files with 42 additions and 45 deletions
|
@ -8,6 +8,8 @@
|
||||||
wall.push(Crafty.e("Wall").wall(0,0,10,240));
|
wall.push(Crafty.e("Wall").wall(0,0,10,240));
|
||||||
wall.push(Crafty.e("Wall").wall(10,0,230,10));
|
wall.push(Crafty.e("Wall").wall(10,0,230,10));
|
||||||
|
|
||||||
|
var cur_sel;
|
||||||
|
|
||||||
var player={};
|
var player={};
|
||||||
player["Gesina"]=(new Player({"pname":"Gesina", "cname":"Aknya", "class":"Zauberin", "level":0, "experience":0,
|
player["Gesina"]=(new Player({"pname":"Gesina", "cname":"Aknya", "class":"Zauberin", "level":0, "experience":0,
|
||||||
"race":"Mensch", "size":2},
|
"race":"Mensch", "size":2},
|
||||||
|
@ -17,8 +19,14 @@
|
||||||
|
|
||||||
// player.push(Crafty.e("Creature").player(40,40,40,40,'red'));
|
// player.push(Crafty.e("Creature").player(40,40,40,40,'red'));
|
||||||
|
|
||||||
/* var beasts = [];
|
|
||||||
beasts.push(Crafty.e("Creature").creature("Hobgob1",100,100,30,30,'red'));*/
|
player["HobGob1"]=(new Beast({"pname":"HobGob1", "experience":71, "race":"Hobgoblin", "size":2},
|
||||||
|
{"body":11, "agility":6, "spirit":3},
|
||||||
|
{"strength":2,"hardness":3,"movement":0,"skill":3,"mind":2,"aura":0},
|
||||||
|
{"x":90,"y":90,"w":30,"h":30,"col":"red"}));
|
||||||
|
|
||||||
|
|
||||||
|
/*.push(Crafty.e("Creature").creature("Hobgob1",100,100,30,30,'red'));*/
|
||||||
|
|
||||||
end_init();
|
end_init();
|
||||||
}
|
}
|
||||||
|
|
57
src/jsds.js
57
src/jsds.js
|
@ -25,44 +25,29 @@
|
||||||
$('#output').html(this.info.cname+"<br>"+this.info.pname);
|
$('#output').html(this.info.cname+"<br>"+this.info.pname);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function Beast(info,attributes,properties,drawinfo){ // x,y,w,h,col) {
|
||||||
|
/* info: pname, experience, race, size
|
||||||
|
* attributes: body, agility, spirit
|
||||||
|
* properties: strength, hardness, movement, skill, mind, aura
|
||||||
|
* drawinfo: x,y,w,h,col
|
||||||
|
*/
|
||||||
|
|
||||||
function Creature(x,y,w,h,col) {
|
this.info = {"pname": info["pname"]+"", "experience": info["experience"]*1, "race":info["race"]+"",
|
||||||
life
|
"size":info["size"]*1};
|
||||||
race
|
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};
|
||||||
|
|
||||||
size
|
this.graphelement = Crafty.e("Creature").creature(this.info["pname"],drawinfo["x"],drawinfo["y"],drawinfo["w"],
|
||||||
|
drawinfo["h"],drawinfo["col"]);
|
||||||
body
|
|
||||||
agility
|
|
||||||
spirit
|
|
||||||
|
|
||||||
strength
|
|
||||||
hardness
|
|
||||||
movement
|
|
||||||
skill
|
|
||||||
mind
|
|
||||||
aura
|
|
||||||
|
|
||||||
life_base
|
|
||||||
def_base
|
|
||||||
ini
|
|
||||||
walk
|
|
||||||
melee
|
|
||||||
shoot
|
|
||||||
chanting
|
|
||||||
shot_chant
|
|
||||||
bweapon
|
|
||||||
barmor
|
|
||||||
bchant
|
|
||||||
|
|
||||||
x
|
|
||||||
y
|
|
||||||
w
|
|
||||||
h
|
|
||||||
color
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* function Beast() {
|
Beast.prototype.printoutput = function() {
|
||||||
experience
|
$('#output').empty();
|
||||||
};*/
|
$('#output').html(this.info.race+"<br>"+this.info.pname);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,12 +70,16 @@
|
||||||
if(e.mouseButton === Crafty.mouseButtons.LEFT) {
|
if(e.mouseButton === Crafty.mouseButtons.LEFT) {
|
||||||
this.old_pos["x"]=this.x;
|
this.old_pos["x"]=this.x;
|
||||||
this.old_pos["y"]=this.y;
|
this.old_pos["y"]=this.y;
|
||||||
|
Crafty("Creature").each( function() {
|
||||||
|
this.disableControl();
|
||||||
|
});
|
||||||
|
cur_sel=player[this.id];
|
||||||
|
cur_sel.printoutput();
|
||||||
|
this.enableControl();
|
||||||
};
|
};
|
||||||
Crafty("Creature").each( function() {
|
/* if(e.mouseButton === Crafty.mouseButtons.RIGHT) {
|
||||||
this.disableControl();
|
cur_sel.attack(player[this.id]);
|
||||||
});
|
};*/
|
||||||
player[this.id].printoutput();
|
|
||||||
this.enableControl();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
Loading…
Reference in a new issue