-
Notifications
You must be signed in to change notification settings - Fork 0
/
pieces.js
39 lines (37 loc) · 2.79 KB
/
pieces.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const titan_1 = '<div class="titan coin b" id="titan_b"><img src="images/titan.svg" alt="" class = "titan" height=40px></div>'
const titan_2 = '<div class="titan coin w" id="titan_w"><img src="images/titan.svg" alt="" class = "titan" height=40px></div>'
const tank_1 = '<div class="tank coin b" id="tank_b"><img src="images/tank.svg" alt="" class = "titan" height=40px></div>'
const tank_2 = '<div class="tank coin w" id="tank_w"><img src="images/tank.svg" alt="" class = "titan" height=40px></div>'
const cannon_1 = '<div class="cannon coin b" id="cannon_b"><img src="images/cannon.svg" alt="" class = "titan" height=40px></div>'
const cannon_2 = '<div class="cannon coin w" id="cannon_w"><img src="images/cannon.svg" alt="" class = "titan" height=40px></div>'
const ricochet_1 = '<div class="ricochet coin b" id="ricochet_b" style="transform:rotate(0deg)"><img style="transform:rotate(90deg)" src="images/Ricochet.svg" alt="" class = "titan" height=40px></div>'
const ricochet_2 = '<div class="ricochet coin w" id="ricochet_w" style="transform:rotate(0deg)"><img style="transform:rotate(90deg)" src="images/Ricochet.svg" alt="" class = "titan" height=40px></div>'
const semi_1 = '<div class="semiricochet coin b" id="semi_b" style="transform:rotate(180deg)"><img style="transform:rotate(90deg)" src="images/half-ricochet.svg" alt="" class = "titan" height=40px></div>'
const semi_2 = '<div class="semiricochet coin w" id="semi_w" style="transform:rotate(0deg)"><img style="transform:rotate(90deg)" src="images/half-ricochet.svg" alt="" class = "titan" height=40px></div>'
const bullet_1 = '<div class="bullet" id="bullet_b"> <img style="transform:rotate(90deg)" src="images/bullet.svg" alt="" class = "titan" height=200px></div>'
const bullet_2 = '<div class="bullet" id="bullet_w"><img style="transform:rotate(90deg)" src="images/bullet.svg" alt="" class = "titan" height=200px></div>'
const htmlToElement = function(html) {
const template = document.createElement('template');
template.innerHTML = html;
return template.content.firstChild;
}
const titan_b = htmlToElement(titan_1);
const titan_w = htmlToElement(titan_2);
const cannon_b = htmlToElement(cannon_1);
cannon_b.dataset.health = 3;
const cannon_w = htmlToElement(cannon_2);
cannon_w.dataset.health = 3;
const tank_b = htmlToElement(tank_1);
tank_b.dataset.health = 5;
const tank_w = htmlToElement(tank_2);
tank_w.dataset.health = 5;
const ricochet_b_1 = htmlToElement(ricochet_1);
const ricochet_b_2 = htmlToElement(ricochet_1);
const ricochet_w_1 = htmlToElement(ricochet_2);
const ricochet_w_2 = htmlToElement(ricochet_2);
const semi_b_1 = htmlToElement(semi_1);
const semi_w_1 = htmlToElement(semi_2);
const semi_b_2 = htmlToElement(semi_1);
const semi_w_2 = htmlToElement(semi_2);
const bullet_b = htmlToElement(bullet_1);
const bullet_w = htmlToElement(bullet_2);