Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function() {
- $(".button").click(roll);
- $(".img").click(function() {
- var index = $(this).index();
- h[index] = true;
- });
- $(".inputs").click(function() {
- console.log(total);
- $(this).attr("disabled", true);
- $(".inputs").each(function() {
- if(!($(this).is(':disabled'))) {
- $(this).val('');
- }
- });
- total += parseInt($(this).val());
- $(".inputTotal").val(total)
- });
- var total = 0;
- var sum = 0;
- var bonus = 50;
- var arr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
- });
- var h = [false, false, false, false, false];
- function roll() {
- if(getThrowCount() <= 2) {
- console.log(getThrowCount());
- throwDice(h);
- var values = getValues();
- var results = getResults();
- $(".inputs").each(function(i) {
- if(!($(this).is(':disabled'))) {
- $(this).val(results[i]);
- }});
- $(".img").each(function(i) {
- console.log(values);
- if(values[i] === 1) {
- $(this).attr('src',"img/dice-six-faces-one.png");
- }else if(values[i] === 2) {
- $(this).attr('src',"img/dice-six-faces-two.png");
- }else if(values[i] === 3) {
- $(this).attr('src',"img/dice-six-faces-three.png");
- }else if(values[i] === 4) {
- $(this).attr('src',"img/dice-six-faces-four.png");
- }else if(values[i] === 5) {
- $(this).attr('src',"img/dice-six-faces-five.png");
- }else {
- $(this).attr('src',"img/dice-six-faces-six.png");
- }
- });
- console.log(h);
- }
- }
- function takeTurn() {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement