Html5经典塔防游戏runner源码
Html JavaScript游戏源码Runner.loadImage = function()
{
var img = new Image();
img.onload = Runner.imgLoadHandler;
img.src = imageURLs.shift();
ImageManager.push(img);
document.getElementById("status").innerHTML = "Loading(" loaded "/6)" ": " img.src;
}
Runner.imgLoadHandler = function(e)
{
loaded ;
if(imageURLs.length > 0) Runner.loadImage();
else
{
document.getElementById("status").innerHTML = "";
document.getElementById("main").style.backgroundImage = "url(" ImageManager[0].src ")";
window.Astar = casual.Astar;
//init canvas
canvas = document.getElementById("canvas");
canvas.width = 1200;
canvas.height = 580;
//disabled canvas right menu
canvas.oncontextmenu = function(){return false;};
context = canvas.getContext("2d");
//ready, go
ImageManager.init();
Runner.createGame();
}
}
评论