I am in a group that is editing source code for an existing Javascript/HTML5 game, and we are attempting to make it into our own game for a group project for school. I am having issues changing the background canvas into an image I found. To my knowledge, this is all of the code given for creating the canvas in the existing code.
var CANVAS_WIDTH = 320;
var CANVAS_HEIGHT = 300;
var canvasElement = $("<canvas width='" + CANVAS_WIDTH +
"' height='" + CANVAS_HEIGHT + "'></canvas");
var canvas = canvasElement.get(0).getContext("2d");
canvasElement.appendTo('body');
The original source code is given from this link: http://www.html5rocks.com/en/tutorials/canvas/notearsgame/
The guy says he is using jquery for the canvas by the way. I have no idea how that effects things. Basically, I'm just trying to change the background image for the game to space or a picture of space. Any help would be appreciated, Thank you!