diff --git a/index.html b/index.html index f41af2e..4fd0ddc 100644 --- a/index.html +++ b/index.html @@ -9,9 +9,11 @@
+
+ diff --git a/src/adventure_01.js b/src/adventure_01.js index 5c55690..66faf8d 100644 --- a/src/adventure_01.js +++ b/src/adventure_01.js @@ -8,9 +8,17 @@ wall.push(Crafty.e("Wall").wall(0,0,10,240)); wall.push(Crafty.e("Wall").wall(10,0,230,10)); - var player = []; - player.push(Crafty.e("Creature").player(40,40,40,40,'red')); - player.push(Crafty.e("Creature").player(100,100,30,30,'blue')); + var player={}; + player["Gesina"]=(new Player({"pname":"Gesina", "cname":"Aknya", "class":"Zauberin", "level":0, "experience":0, + "race":"Mensch", "size":2}, + {"body":6, "agility":6, "spirit":8}, + {"strength":0,"hardness":2,"movement":0,"skill":3,"mind":3,"aura":3}, + {"x":40,"y":40,"w":40,"h":40,"col":"blue"})); + +// 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'));*/ end_init(); } diff --git a/src/jsds.js b/src/jsds.js new file mode 100644 index 0000000..d4b0aac --- /dev/null +++ b/src/jsds.js @@ -0,0 +1,68 @@ +{ + 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 + */ + + // 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}; + 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"]); + }; + + Player.prototype.printoutput = function() { + $('#output').empty(); + $('#output').html(this.info.cname+"
"+this.info.pname); + }; + + + function Creature(x,y,w,h,col) { + life + race + + size + + 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() { + experience + };*/ +} diff --git a/src/jsds_crafty.js b/src/jsds_crafty.js index 5467f73..79b93bd 100644 --- a/src/jsds_crafty.js +++ b/src/jsds_crafty.js @@ -46,7 +46,8 @@ init: function() { this.addComponent("Thing,Fourway,Draggable,Collision,WiredHitBox,Mouse,creature,coll"); }, - player: function(x,y,w,h,col) { + creature: function(id,x,y,w,h,col) { + this.id=id || ""; this.h = h || 40; this.w = w || 40; this.thing(x,y,w,h,col) @@ -73,6 +74,7 @@ Crafty("Creature").each( function() { this.disableControl(); }); + player[this.id].printoutput(); this.enableControl(); });