Iso Game

by Robodude

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/kineticjs/5.2.0/kinetic.min.js"></script>
<!--        <button id="draw">Draw</button>
        <button id="printCircleCoords">Get Circle Coords</button>
        <button id="getStage">Get Stage</button>-->
        <!--<button id="checkPoints">Point Checking Unit Test</button>-->
                
<!--        <button id="prevLevel">Previous Level</button>
        <button id="nextLevel">Next Level</button>
        <button id="resetLevel">Reset Level</button>
        <button id="randomLevel">Random Level</button>-->
        <button id="start">Start 1 Minute Blitz</button>
        <span id="clock"></span>
        <br />

        <div id="container"></div>

CSS

#container
    {
        width: 1000px;
        height: 600px;
        border: 1px solid black;
    }

JavaScript

var stage;
    var level = 0;
    var maxLevel = levelData().length;
    var timer;
    var time = 0;
    var maxTime = 60 * 1000;
    var points = 0;
    var interval = 10;

    $(document).ready(function () {
        $("#draw").click(function () {
            stage.draw();
        });

        $("#getStage").click(function () {
            console.log(stage);
        });

        $("#nextLevel").click(function () {
            nextLevel();
        });

        $("#prevLevel").click(function () {
            previousLevel();
        });

        $("#resetLevel").click(function () {
            resetLevel();
        });

        $("#randomLevel").click(function () {
            randomLevel();
        });

        $("#start").click(function () {
            points = 0;
            time = 0;
            timer = null;

            randomLevel();

            updateClock();

        });

        $("#checkPoints").click(function () {
            console.log("TRUE -> " + arePointsEqual([{ x: 0, y: 0 }, { x: 1, y: 1 }], [{ x: 0, y: 0 }, { x: 1, y: 1 }]));
            console.log("TRUE -> " + arePointsEqual([{ x: 1, y: 1 }, { x: 0, y: 0 }], [{ x: 0, y: 0 }, { x: 1, y: 1 }]));
            console.log("TRUE -> " + arePointsEqual([{ x: 1, y: 1 }, { x: 0, y: 0 }], [{ x: 1, y: 1 }, { x: 0, y: 0 }]));
            console.log("TRUE -> " + arePointsEqual([{ x: 0, y: 0 }, { x: 1, y: 1 }], [{ x: 1, y: 1 }, { x: 0, y: 0 }]));
            console.log("FALSE -> " + arePointsEqual([{ x: 0, y: 1 }, { x: 1, y: 1 }], [{ x: 1, y: 1 }, { x: 0, y: 0 }]));
            console.log("FALSE -> " + arePointsEqual([{ x: 0, y: 0 }, { x: 0, y: 1 }], [{ x: 1, y: 1 }, { x: 0, y: 0 }]));
            console.log("FALSE -> " + arePointsEqual([{ x: 0, y: 1 }, { x: 1, y: 1 }], [{ x: 2, y: 1 }, { x: 0, y: 0 }]));
            console.log("FALSE -> " + arePointsEqual([{ x: 0, y: 0 }, { x: 0, y: 1 }], [{ x: 1, y: 1 }, { x: 0, y: 2 }]));
            console.log("FALSE -> " + arePointsEqual([{ x: 1, y: 0 }, { x:...