+ 16
Please!!! Help me!
Look at my code named "Platform Game". It draws nothing on canvas and shows error. Pls help!
2 Respuestas
+ 3
you have not defined ctx
+ 3
the error occours because you defined de ctx locally on window.onload. get the context globally, out of the function, like so:
var can = document.createElement("canvas");
var ctx = can.getContext("2d");
window.onload = function(){
can.width = window.innerWidth;
[...]