Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en">`

<head>
<meta charset="UTF-8">
Expand All @@ -11,6 +11,7 @@
<body>
<script src="models/unit.js"></script>
<script src="models/croco-turtle.js"></script>
<script src="models/snake.js"></script>
<script src="models/monster-bear.js"></script>
<script src="script.js"></script>
</body>
Expand Down
6 changes: 6 additions & 0 deletions models/croco-turtle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}());
9 changes: 9 additions & 0 deletions models/kingkong.js
Original file line number Diff line number Diff line change
@@ -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;
}());
9 changes: 9 additions & 0 deletions models/scalapender.js
Original file line number Diff line number Diff line change
@@ -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;
}());
10 changes: 4 additions & 6 deletions models/snake.js
Original file line number Diff line number Diff line change
@@ -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;
}());
9 changes: 9 additions & 0 deletions models/spider.js
Original file line number Diff line number Diff line change
@@ -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;
}());
6 changes: 3 additions & 3 deletions models/unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}());
1 change: 0 additions & 1 deletion models/wolf.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ var Wolf = (function() {

return Wolf;
}());

12 changes: 8 additions & 4 deletions script.js
Original file line number Diff line number Diff line change
@@ -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();