diff --git a/TODO b/TODO index dae3cc4..9277af5 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,5 @@ ToDo for JSDSH: - - Implement FrontEnd (Add Player, etc) + - Implement FrontEnd (Add Player, etc) ? - Implement Player, Creatures - Background and Wall Editing/Importing - Shoot, Attack diff --git a/index.html b/index.html index 90ee3e7..3a5f423 100644 --- a/index.html +++ b/index.html @@ -8,6 +8,7 @@

JSDSH - Javascript Dungeonslayers Helper

- + + diff --git a/src/adventure_01.js b/src/adventure_01.js new file mode 100644 index 0000000..06221e8 --- /dev/null +++ b/src/adventure_01.js @@ -0,0 +1,14 @@ +{ + var wall = []; + + wall.push(Crafty.e("Wall").wall(240,0,10,250)); + wall.push(Crafty.e("Wall").wall(0,240,240,10)); + 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')); + + end_init(); +} diff --git a/src/jsds.js b/src/jsds_crafty.js similarity index 68% rename from src/jsds.js rename to src/jsds_crafty.js index 69a3a6f..2294099 100644 --- a/src/jsds.js +++ b/src/jsds_crafty.js @@ -1,6 +1,6 @@ { Crafty.init(500,250, document.getElementById('game')); - + Crafty.c( "Wall", { init: function() { @@ -46,13 +46,13 @@ } ); -/* Crafty.c( - "Creature", { - init: function() { - this.addComponent*/ - + /* Crafty.c( + "Creature", { + init: function() { + this.addComponent*/ + Crafty.c( - "Player", { + "Creature", { init: function() { this.addComponent("Thing,Fourway,Draggable,Collision,WiredHitBox,Mouse,player"); }, @@ -74,35 +74,31 @@ if(e.mouseButton === Crafty.mouseButtons.LEFT) { this.old_pos["x"]=this.x; this.old_pos["y"]=this.y; - console.log("New Pos saved: "+this.old_pos["x"]+' '+this.old_pos["y"]); }; + Crafty("Creature").each( function() { + this.disableControl(); + }); + this.enableControl(); }); return this; } } ); + /* var fig=Crafty.e('Collision, 2D, Canvas, Color,Fourway,Draggable,WiredHitBox,Mouse,player') + .attr({x: 20, y: 20, w: 100, h: 100}) + .color('#F00') + .fourway(4) + .collision() + .onHit("wall",function() { + this.stopDrag(); + + });*/ - var wall = []; - - wall.push(Crafty.e("Wall").wall(240,0,10,250)); - wall.push(Crafty.e("Wall").wall(0,240,240,10)); - 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("Player").player(40,40,40,40,'red')); - player.push(Crafty.e("Player").player(100,100,30,30,'blue')); -/* var fig=Crafty.e('Collision, 2D, Canvas, Color,Fourway,Draggable,WiredHitBox,Mouse,player') - .attr({x: 20, y: 20, w: 100, h: 100}) - .color('#F00') - .fourway(4) - .collision() - .onHit("wall",function() { - this.stopDrag(); - - });*/ - - - + var end_init= function() { + Crafty("Creature").each( function() { + this.disableControl(); + }); + }; + }