Zombie Dice
HTML
<div id="results"></div>
CSS
body { background: #333; }
.a0 {
background: #FF392B;
}
.a1 {
background: #FEE97F;
}
.a2 {
background: #7AFB58;
}
#results div {
float:left;
margin: 20px;
padding: 20px 10px;
width: 80px;
font-size: 2em;
border-radius: 5px;
box-shadow: inset 0 2px 1px rgba(255,255,255,0.5),
inset 0 -3px 10px rgba(0,0,0,0.2),
0 1px 3px black;
}
JavaScript
// display brains and shotguns. display 4 player scores. create stop turn that adds brains to score. auto end without adding brains to the score if rolled 3 shotguns.
var dice = [
['S', 'S', 'S', 'F', 'F', 'B'],
['S', 'S', 'F', 'F', 'B', 'B'],
['B', 'B', 'B', 'F', 'F', 'S'],
[]
],results = document.getElementById('results');
function rollDice() {
for (var i = 0; i < 13; i++) {
var randColor = Math.floor(Math.random() * 3),
randSide = Math.floor(Math.random() * 6),
store = {
color: randColor,
face: randSide,
roll: i + 1
};
results.innerHTML += '<div class=\"a' + randColor + '\">' + (i + 1) + ' ' + dice[randColor][randSide] + '<\/div>';
dice[3].push(store);
}
}
rollDice();