diff --git a/index.html b/index.html index bcdf23b..d70a2aa 100644 --- a/index.html +++ b/index.html @@ -9,6 +9,9 @@ + + +
diff --git a/models/battleground.js b/models/battleground.js index d7d0a80..1421595 100644 --- a/models/battleground.js +++ b/models/battleground.js @@ -1,3 +1,56 @@ +// var BattleGround = (function() { +// function BattleGround(element, size, amountOfMonsters) { +// this.wrapperElement = null; +// this.cellsElement = null; +// this.controllsElement = null; +// this.element = element; +// this.size = size; +// this.amountOfMonsters = amountOfMonsters || size / 2; +// this.area = new Array(size).fill(1).map(function() { +// return new Grass(); +// }); +// this.render(); +// this.update(); +// } + +// BattleGround.prototype.fill = function(monstersArr) { +// var self = this; +// Array(this.amountOfMonsters) +// .fill(1) +// .forEach(function() { +// self.area[random(1, self.area.length)] = new monstersArr[ +// random(0, monstersArr.length) +// ](random(1, 3)); +// }); + +// this.update(); +// }; + +// BattleGround.prototype.render = function() { +// var ul = document.querySelector('.ul'); + +// this.area.forEach(function(el) { +// ul.append +// }) +// for (var i = 1; i < this.size; i++) { +// var li = document.createElement('li') +// li.innerHTML +// ul.append(li) +// } +// }; + +// BattleGround.prototype.addCharacter = function(character) { +// this.area[0] = character; +// }; + +// return BattleGround; +// })(); + + + + + + var BattleGround = (function() { function BattleGround(element, size, amountOfMonsters) { this.wrapperElement = null; @@ -90,4 +143,4 @@ var BattleGround = (function() { }; return BattleGround; -})(); +})(); \ No newline at end of file diff --git a/models/unit.js b/models/unit.js index 45d2572..b8b819c 100644 --- a/models/unit.js +++ b/models/unit.js @@ -7,14 +7,16 @@ var Unit = (function() { this.maxHealth = this.health = health + modifier; this.level = level; } - + Unit.prototype.attack = function() { - console.log('Attack', this); - }; + console.log('Attack', this) + } + + Unit.prototype.render = function() { return this.el; - }; + } return Unit; })(); diff --git a/style.css b/style.css index bab9809..d2b8a8d 100644 --- a/style.css +++ b/style.css @@ -1,3 +1,29 @@ +/* .ul { + padding: 0; + display: flex; + align-items: center; + justify-content: center; +} + +.ul li { + display: flex; + list-style-type: none; + width: 70px; + height: 30px; + margin: 5px; + align-self: baseline; + border: 1px solid #8B0000; + padding: 5px; +} + +.ul li:hover { + cursor: pointer; + transform: scale(1.2); + box-shadow: inset 0 0 0 1px #B22222; +} */ + + + html, body, #wrapper { @@ -39,4 +65,4 @@ body, display: flex; width: 100%; height: 100%; -} +} \ No newline at end of file diff --git a/utils/dom.js b/utils/dom.js index 5afafca..ea473dc 100644 --- a/utils/dom.js +++ b/utils/dom.js @@ -1,16 +1,16 @@ function consoleNodesRecursive(root) { - console.dir(root); - root.childNodes.forEach(function(child) { - if (child.childNodes && child.childNodes.length) { - console.group("ELEMENT " + child.tagName); - consoleNodesRecursive(child); - console.groupEnd(); - } else { - var value = - child.nodeType !== Node.TEXT_NODE && child.tagName !== "SCRIPT" - ? child.nodeValue.trim() || "" - : ""; - console.log(child.nodeName, value); - } - }); -} + console.dir(root); + root.childNodes.forEach(function(child) { + if (child.childNodes && child.childNodes.length) { + console.group("ELEMENT " + child.tagName); + consoleNodesRecursive(child); + console.groupEnd(); + } else { + var value = + child.nodeType !== Node.TEXT_NODE && child.tagName !== "SCRIPT" + ? child.nodeValue.trim() || "" + : ""; + console.log(child.nodeName, value); + } + }); + }