Back to Shut the Box Project

Shut the Box Project - Final Updates

Final Additional Scripts

Instructions:

This is the final update to scripts. Copy and Paste these conditionals into the getScore() and endGame() functions respectively. Also, I offer some suggestions to polishing the game. Make sure you use copy right free images and make the most of the CSS tricks to improve our quick and dirty UX/UI.

    //a nice animation or animated gift should be done 
    //instead of just this boring alert
    if (score==0) {
        alert("You SHUT THE BOX! Sweet Rolling!");
        endGame();
    };
            
    // End the round if a player exceeds 45 and reset some items
    if (temp>45) {
        alert("Player "+player+" won this round.");
        player=1;
        games=0;
        allScoresP1 = Array();
        allScoresP2 = Array();
        $("#P1games").text(allScores);
        $("#P2games").text(allScores2);
        $("#p1").text("0");
        $("#p2").text("0");
    };
            

You can add additions like different ways to score or win the round of games. For instance, you can play a set amount of rounds or until an agreed upon total. Another way to score is to use the digits left to make a number. So if 2, 6, and 9 are left, they score 269. This could create some fun alternatives to winning the overall game and strategies to choose tiles. And finally, make a menu screen that chooses parameters and number of players, use animated gifts for scoring zero or winning the game. Good luck!

David Johns and Electric Teaching ~ All Rights Reserved 2016