diff --git a/index.html b/index.html index ac51185..091e869 100644 --- a/index.html +++ b/index.html @@ -1,5 +1,5 @@ - +` @@ -11,6 +11,7 @@ + diff --git a/models/croco-turtle.js b/models/croco-turtle.js index c0e7f6c..86d71c5 100644 --- a/models/croco-turtle.js +++ b/models/croco-turtle.js @@ -5,6 +5,12 @@ var CrocoTurtle = (function () { CrocoTurtle.prototype = Object.create(Unit.prototype); CrocoTurtle.prototype.constructor = CrocoTurtle; + CrocoTurtle.prototype.step = function (){ + console.log('Step'); + }; + CrocoTurtle.prototype.attak = function(monster){ + this.health -= monster.damage; + } return CrocoTurtle; }()); diff --git a/models/kingkong.js b/models/kingkong.js new file mode 100644 index 0000000..df5f9b4 --- /dev/null +++ b/models/kingkong.js @@ -0,0 +1,9 @@ +var KingKong = (function() { + function KingKong(level) { + Unit.call(this, 500, 1500, level); + } + KingKong.prototype = Object.create(Unit.prototype); + KingKong.prototype.constructor = KingKong; + + return KingKong; +}()); \ No newline at end of file diff --git a/models/scalapender.js b/models/scalapender.js new file mode 100644 index 0000000..1d5a280 --- /dev/null +++ b/models/scalapender.js @@ -0,0 +1,9 @@ +var Scalapender = (function() { + function Scalapender(level) { + Unit.call(this, 150, 1000, level); + } + Scalapender.prototype = Object.create(Unit.prototype); + Scalapender.prototype.constructor = Scalapender; + + return Scalapender; +}()); \ No newline at end of file diff --git a/models/snake.js b/models/snake.js index 3307f87..d650193 100644 --- a/models/snake.js +++ b/models/snake.js @@ -1,11 +1,9 @@ -var Snake = (function () { +var Snake = (function() { function Snake(level) { - Unit.call(this, 50, 50, level); - } - + Unit.call(this, 150, 1000, level); + } Snake.prototype = Object.create(Unit.prototype); Snake.prototype.constructor = Snake; - - + return Snake; }()); diff --git a/models/spider.js b/models/spider.js new file mode 100644 index 0000000..0892ddf --- /dev/null +++ b/models/spider.js @@ -0,0 +1,9 @@ +var Spider = (function() { + function Spider(level) { + Unit.call(this, 150, 1000, level); + } + Spider.prototype = Object.create(Unit.prototype); + Spider.prototype.constructor = Spider; + + return Spider; +}()); \ No newline at end of file diff --git a/models/unit.js b/models/unit.js index e72f1b7..1b88ad9 100644 --- a/models/unit.js +++ b/models/unit.js @@ -6,9 +6,9 @@ var Unit = (function () { this.level = level; } - Unit.prototype.attack = function () { - console.log('Attack', this); - } + // Unit.prototype.attack = function () { + // console.log('Attack', this); + // } return Unit; }()); diff --git a/models/wolf.js b/models/wolf.js index 92c7f1b..5ea4daa 100644 --- a/models/wolf.js +++ b/models/wolf.js @@ -8,4 +8,3 @@ var Wolf = (function() { return Wolf; }()); - diff --git a/script.js b/script.js index 1e3cba9..d88f96c 100644 --- a/script.js +++ b/script.js @@ -1,5 +1,9 @@ -var croco = new CrocoTurtle(50); -var bear = new MonsterBear(2); +var croco = new CrocoTurtle(1); +var bear = new MonsterBear(1); +var snac = new Snake(1); + +croco.attak(bear); +croco.attak(snac); + +console.log(croco); -croco.attack(); -bear.attack();