//创建画布
var canvas=document.createElement("canvas");
var ctx=canvas.getContext("2d");
canvas.width=512;
canvas.height=480;
document.body.appendChild(canvas);//加载背景图像
var bgReady=false;
var bgImage=newImage();
bgImage.onload=function(){
bgReady=true;};
bgImage.src="images/background.png";//背景2
var bgReady2=false;
var bgImage2=newImage();
bgImage2.onload=function(){
bgReady2=true;