ubuntu kylin 14.10下多個mysql 5.7.14裝置教程。本站提示廣大學習愛好者:(ubuntu kylin 14.10下多個mysql 5.7.14裝置教程)文章只能為提供參考,不一定能成為您想要的結果。以下是ubuntu kylin 14.10下多個mysql 5.7.14裝置教程正文
根本常識:
HTML5 CSS JS
本游戲包含三個文件:
RusBlock.html:設定元素
RusBlock.css:設定款式
RusBlock.js:劇本掌握
第一步:界面的設置和素材的預備
RusBlock.html
<!DOCTYPE html>
<html>
<head>
<title>RusBlock</title>
<link rel=”stylesheet” type=”text/css” href=”RusBlock.css”>
<script type=”text/javascript”>
function ShareGame() {
var URL = “http://share.renren.com/share/buttonshare.do?link=” + document.URL + “&title=RusBlock”;
window.showModalDialog([URL]);
}
</script>
</head>
<body onkeyup=”Action(event)”>
<audio loop=”loop” id=”Background-AudioPlayer” preload=”auto”>
<source src=”audio/background.mp3″ type=”audio/mp3″/>
</audio>
<audio id=”GameOver-AudioPlayer” preload=”auto”>
<source src=”audio/gameover.ogg” type=”audio/ogg”>
</audio>
<audio id=”Score-AudioPlayer” preload=”auto”>
<source src=”audio/score.mp3″ type=”audio/mp3″/>
</audio>
<div id=”Game-Area”>
<div id=”Button-Area”>
<h1 id=”Game-Name”>RusBlock</h1>
<button id=”Button-Game-Start” onclick=”GameStart()”>Start</button>
<button id=”Button-Game-End” onclick=”GameEnd()”>End</button>
<form id=”Form-Game-Level”>
<select id=”Select-Game-Level”>
<option value=”500″ selected=”selected”>Easy</option>
<option value=”300″>Normal</option>
<option value=”200″>Hard</option>
</select>
</form>
<button onclick=”ShareGame()” id=”Button-Game-Share”>分享到人人</button>
</div>
<canvas id=”Game-Canvas”></canvas>
<div id=”Score-Area”>
<h2>Score</h2>
<p id=”Game-Score”>0</p>
</div>
</div>
<script type=”text/javascript” src=”RusBlock.js”></script>
</body>
</html>
第二步:款式
RosBlock.css
body {
background-color:gray;
text-align:center;
font-family:’Times New Roman’;
background-image:url(“”);
}
h1#Game-Name {
background-color:white;
width:100%;
font-size:x-large;
}
h2,#Game-Score {
font-size:x-large;
background-color:white;
}
#Game-Area {
position:absolute;
left:10%;
width:80%;
height:99%;
}
canvas#Game-Canvas {
background-color:white;
width:80%;
height:98%;
float:left;
}
#Button-Area ,#Score-Area{
width:10%;
height:100%;
float:left;
}
#Button-Game-Start ,#Button-Game-End,#Button-Game-Share,#Select-Game-Level{
width:100%;
height:10%;
font-size:larger;
border-right-width:3px;
background-color:white;
}
#Select-Game-Level {
width:100%;
height:100%;
font-size:x-large;
border-color:gray;
}
第三步:編寫js代碼
RusBlock.js
Rusblock類包含的成員解析:
數據:
nCurrentComID:以後著落部件的ID
aState[21][25]:存儲游戲區域狀況的數組
CurrentCom:以後著落的部件
NextCom:下一部件
ptIndex:以後著落的部件絕對游戲區域的索引
函數:
NewNextCom():發生新的下一部件
NextComToCurrentCom():將下一部件的數據轉移到以後著落的部件上
CanDown():斷定以後部件能否還可以著落
CanNew():斷定能否還可以發生新的部件
Left():以後部件向左挪動
Right():以後部件向右挪動
Rotate():以後部件順時針扭轉
Acceleratet():以後部件向下加快
Disappear():消去一行
CheckFail():斷定能否游戲掉敗
InvalidateRect():刷新以後部件的區域
完成:下載Demo