当前位置: 首页 > 工具软件 > Blockrain.js > 使用案例 >

JS 写的俄罗斯方块游戏

岳出野
2023-12-01

http://www.htmleaf.com/html5/html5youxi/201501201236.html


https://github.com/Aerolab/blockrain.js/blob/gh-pages/src/blockrain.jquery.src.js


<!doctype html>
<html lang="zh">
	<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="css/normalize.css" />
	<link rel="stylesheet" type="text/css" href="css/default.css">
	<link rel="stylesheet" type="text/css" href="css/style.css">
	<link href="css/blockrain.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="game" style="width:440px; height:800px;">
</div>
<a href="javascript:;" οnclick="pause()" >暂停</a> , 
<a href="javascript:;" οnclick="repause()" >取消暂停</a>

<script src="http://libs.useso.com/js/jquery/1.11.0/jquery.min.js" type="text/javascript"></script>
<script src="js/blockrain.jquery.min.js" type="text/javascript"></script>
<script>

$('.game').blockrain({
	speed: 12,
	playText: '准备开始游戏!',
	playButtonText: '开始',
	gameOverText: '你失败了!',
	restartButtonText: '再来一把!',
	scoreText: '得分',
	theme: 'candy'
});

function pause() {
	console.log('pause');
$('.game').blockrain('pause');
}
function repause() {
console.log('resume');
$('.game').blockrain('resume');
}
</script>
</body>
</html>


 类似资料: