ge2d License: GPL v3

Simple 2D game engine for js canvas

Example of code

<body>
  
    <noscript>
      The browser doesn't support js code.
    </noscript>
  
    <canvas id="canvas" height="400px" width="600px">
      The browser doesn't support the canvas element.
    </canvas>

    <script src="ge2d.js"></script>
    <script>
        var myGame = new Game("canvas");

        myGame.background_color("darkgray");

        var size = 25;
        (function gameLoop(){

            myGame.clear();

            myGame.rect(15, 15, 200, 100, "cyan");

            // myGame.pointer(reset = true); (for reset click variable)
            if(myGame.pointer(true)["click"]){   
                size += 3;
            }

            myGame.circle(
                myGame.pointer()["x"], 
                myGame.pointer()["y"], 
                size, "blue");

            setTimeout(gameLoop, 5);
        }());
        
    </script>
  
</body>

GitHub

View Github