0

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

8th Aug 2017, 1:30 PM
❮вαιι–кιηgz❯ dario
❮вαιι–кιηgz❯ dario - avatar
8 Respuestas
+ 4
*** code edited to be fully working on playground ***
8th Aug 2017, 9:02 PM
visph
visph - avatar
+ 3
As you put the css and js linked file in the code, you need to have them in same directory of your html file... in code playground you cannot have file in same folder, because it's hosted on sololearn server... So you need to integrate them in css and js tabs, but this could be heavy, or host them elsewhere on internet and put the absolute (complete) url to their location ^^
8th Aug 2017, 5:38 PM
visph
visph - avatar
0
where is the "clarity.js" file ???
8th Aug 2017, 1:48 PM
Mohit Mehta
Mohit Mehta - avatar
0
Go here: https://github.com/dissimulate/Clarity Try copying everything and put it together in a notepad, it wont work.
8th Aug 2017, 2:18 PM
❮вαιι–кιηgz❯ dario
❮вαιι–кιηgz❯ dario - avatar
0
may there is something error in code
8th Aug 2017, 4:42 PM
Mohit Mehta
Mohit Mehta - avatar
- 1
can you go to that link and put the code together for me?
8th Aug 2017, 8:38 PM
❮вαιι–кιηgz❯ dario
❮вαιι–кιηgz❯ dario - avatar
- 1
omg, tysm!
8th Aug 2017, 9:09 PM
❮вαιι–кιηgz❯ dario
❮вαιι–кιηgz❯ dario - avatar