Woah, weird!?
This code only works on 'CodePen', it doesn't work in anything else. Why is that? Please answer me. The Code: <!DOCTYPE html> <html> <head> <title>Clarity</title> <link rel="stylesheet" type="text/css" href="style.css" /> <script type="text/javascript" src="Clarity.js"></script> </head> <body> <canvas id="canvas"></canvas> <p> Use the left, right and up arrow keys to move. </p> <p class="info"> The map data is fully customisable and scriptable (all contained within the "map" variable). See the comments in the code for instructions. </p> <label for="viewport"> <input type="checkbox" id="viewport" onclick="game.limit_viewport=this.checked;" checked/> Confine viewport to map</label> <script type="text/javascript"> window.requestAnimFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(callback) { return window.setTimeout(callback, 1000 / 60); }; var canvas = document.getElementById('canvas'), ctx = canvas.getContext('2d'); canvas.width = 400; canvas.height = 400; /* Customisable map data */ var map = { tile_size: 16, /* Key vairables: id [required] - an integer that corresponds with a tile in the data array. colour [required] - any javascript compatible colour variable. solid [optional] - whether the tile is solid or not, defaults to false. bounce [optional] - how much velocity is preserved upon hitting the tile, 0.5 is half. jump [optional] - whether the player can jump while over the tile, defaults to false. friction [opt