canvas打飞机小游戏

代码语言:html

所属分类:游戏

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>BallFight</title>
<style>
    *{margin:0;padding:0}html,body{height:100%;overflow:hidden}#container{margin:0 auto;text-align:center;width:100%;height:100%}#bt{display:none;width:100px;height:auto;position:absolute;background:#2365a7;font:1.5em Arial;font-color:#ceceec;border-radius:15px}#bt:hover{background:#3c4e61}
</style>
</head>
<body>
<div id="container">
<canvas id="mycanvas" style="border:1px solid #cecece">
浏览器不支持canvas
</canvas>
</div>
<input type="button" id="bt" value="restart" onclick="restart();">
<script>
		document.getElementById('mycanvas').width=document.body.clientWidth;
		document.getElementById('mycanvas').height=document.body.clientHeight;
		window.onresize=function(){
			document.getElementById('mycanvas').width=document.body.clientWidth;
			document.getElementById('mycanvas').height=document.body.clientHeight;
		}
		var ctx=document.getElementById('mycanvas').getContext("2d");
		var W=ctx.canvas.width;
		var H=ctx.canvas.height;
		var RESTART=document.getElementById('bt');
		var SCORE=0;

		function windowTocanvas(dx,dy){
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0