注冊 | 登錄讀書好,好讀書,讀好書!
讀書網(wǎng)-DuShu.com
當(dāng)前位置: 首頁出版圖書科學(xué)技術(shù)計(jì)算機(jī)/網(wǎng)絡(luò)圖形圖像、多媒體、網(wǎng)頁制作JavaScript網(wǎng)頁游戲制作輕松學(xué)

JavaScript網(wǎng)頁游戲制作輕松學(xué)

JavaScript網(wǎng)頁游戲制作輕松學(xué)

定 價(jià):¥49.00

作 者: 程晨 著
出版社: 人民郵電出版社
叢編項(xiàng): i創(chuàng)客
標(biāo) 簽: 暫缺

ISBN: 9787115462381 出版時(shí)間: 2017-08-01 包裝: 平裝
開本: 小16開 頁數(shù): 145 字?jǐn)?shù):  

內(nèi)容簡介

  JavaScript是一種直譯式腳本語言,它的一個(gè)很大的優(yōu)勢就是絕大多數(shù)瀏覽器都包含了JavaScript的解釋器,這樣我們在學(xué)習(xí)JavaScript時(shí)不需要安裝任何開發(fā)軟件,只要寫一個(gè)網(wǎng)頁文件,嵌入JavaScript代碼就能在瀏覽器中進(jìn)行代碼的調(diào)試,非常方便。對于硬件愛好者來說,學(xué)習(xí)JavaScript還有一個(gè)好處就是能讓自己的硬件作品更貼近IoT(物聯(lián)網(wǎng))應(yīng)用。了解了JavaScript,我們能夠在顯示的頁面上實(shí)現(xiàn)更多的效果,同時(shí),目前有很多硬件也支持用JavaScript來編程。本書以制作國際象棋、五子棋、彈球、貪吃蛇、拼圖、打飛機(jī)等經(jīng)典游戲?yàn)槔瑤銖牧闫鸩?,學(xué)習(xí)JavaScript的編程方法,適合對游戲和編程感興趣的初學(xué)者閱讀。而且本書融入了創(chuàng)客的項(xiàng)目式思路,在一個(gè)個(gè)實(shí)例的制作過程中學(xué)習(xí)知識,語言通俗易懂,圖文并茂,會(huì)帶給你與以往內(nèi)容枯燥的編程教程完全不同的全新體驗(yàn)。

作者簡介

  程晨 創(chuàng)客布道師、創(chuàng)客教育踐行者,擁有十多年嵌入式開發(fā)經(jīng)驗(yàn),技術(shù)方面涉獵廣泛,先后主持參與十多項(xiàng)軍民科研產(chǎn)品的研發(fā),擁有多項(xiàng)發(fā)明專利。少年創(chuàng)學(xué)院聯(lián)合創(chuàng)始人兼院長、濼喜教育聯(lián)合創(chuàng)始人兼技術(shù)總監(jiān),兼任Intel軟件創(chuàng)新大使、中國電子學(xué)會(huì)全國青少年機(jī)器人技術(shù)等級考試標(biāo)準(zhǔn)工作組副組長、中國教育技術(shù)協(xié)會(huì)數(shù)字教育資源專業(yè)委員會(huì)專家的職務(wù)。第1本Arduino中文書作者,編著、翻譯開源硬件、3D打印、機(jī)器人、智能硬件、物聯(lián)網(wǎng)等領(lǐng)域相關(guān)圖書十多本,長期在《無線電》雜志刊登技術(shù)類文章。參與錄制CCTV《原來如此》節(jié)目,錄制多套開源硬件項(xiàng)目視頻教程。曾任北京航空航天大學(xué)、北京郵電大學(xué)特聘講師,參與清華大學(xué)、北京科技大學(xué)等多所高校的創(chuàng)新性課程設(shè)計(jì)。

圖書目錄

01  認(rèn)識JavaScript.................................................................................1
1.1 緣起...............................................................................................................1
1.2 歷史...............................................................................................................1
1.3 特性...............................................................................................................2
02 類型和變量.........................................................................................4
2.1 瀏覽器中的控制臺..........................................................................................4
2.2 數(shù)字和運(yùn)算符.................................................................................................5
2.3 變量...............................................................................................................6
2.4 變量命名規(guī)則.................................................................................................7
2.5 字符串.......................................................................................................... 8
2.5.1 連接字符串… ………………………………………………………………………… 9
2.5.2 獲取字符串的長度… ……………………………………………………………… 10
2.5.3 獲取單個(gè)字符… …………………………………………………………………… 10
2.5.4 截取字符串… ……………………………………………………………………… 11
2.5.5 大小寫轉(zhuǎn)化… ……………………………………………………………………… 11
2.6 邏輯運(yùn)算..................................................................................................... 12
2.6.1 布爾類型… ………………………………………………………………………… 12
2.6.2 邏輯運(yùn)算符… ……………………………………………………………………… 12
2.6.3 關(guān)系運(yùn)算符… ……………………………………………………………………… 14
2.7 underfined 和null...................................................................................... 16
2.8 原始類型..................................................................................................... 16
2.8.1 鑒別原始類型… …………………………………………………………………… 16
2.8.2 原始方法… ………………………………………………………………………… 17
03 數(shù)組................................................................................................18
3.1 創(chuàng)建數(shù)組..................................................................................................... 18
3.2 訪問數(shù)組元素.............................................................................................. 18
3.3 修改數(shù)組元素.............................................................................................. 19
3.4 應(yīng)用數(shù)組..................................................................................................... 20
3.4.1 查看數(shù)組長度… …………………………………………………………………… 20
3.4.2 添加數(shù)組元素… …………………………………………………………………… 20
3.4.3 刪除數(shù)組元素… …………………………………………………………………… 21
3.4.4 數(shù)組相加… ………………………………………………………………………… 22
3.4.5 查找元素的序號… ………………………………………………………………… 22
3.4.6 將數(shù)組轉(zhuǎn)換成字符串… …………………………………………………………… 23
04 對話框.............................................................................................24
4.1 HTML 基礎(chǔ)................................................................................................. 24
4.2 嵌入JavaScript 代碼.................................................................................. 25
4.3 對話框........................................................................................................ 27
4.3.1 輸入對話框… ……………………………………………………………………… 27
4.3.2 確定對話框… ……………………………………………………………………… 29
4.3.3 if 語句… …………………………………………………………………………… 31
4.3.4 警告對話框… ……………………………………………………………………… 32
4.4 DOM.......................................................................................................... 33
4.4.1 用ID 標(biāo)識元素……………………………………………………………………… 33
4.4.2 選中元素… ………………………………………………………………………… 34
4.4.3 替換文本內(nèi)容… …………………………………………………………………… 34
05 繪制國際象棋棋盤.............................................................................37
5.1 canvas 元素............................................................................................... 37
5.2 繪制方塊..................................................................................................... 38
5.3 繪制方框..................................................................................................... 39
5.4 繪制棋盤..................................................................................................... 41
5.5 循環(huán)結(jié)構(gòu)..................................................................................................... 42
5.5.1 while 語句… ………………………………………………………………………… 42
5.5.2 do-while 語句… …………………………………………………………………… 43
5.5.3 for 循環(huán)……………………………………………………………………………… 44
06 五子棋.............................................................................................48
6.1 基本繪圖方式.............................................................................................. 48
6.1.1 繪制線條… ………………………………………………………………………… 48
6.1.2 填充路徑… ………………………………………………………………………… 49
6.1.3 繪制圓弧和圓… …………………………………………………………………… 50
6.2 繪制棋盤..................................................................................................... 51
6.3 鼠標(biāo)交互..................................................................................................... 52
6.4 繪制棋子..................................................................................................... 54
6.5 黑子和白子................................................................................................. 56
6.6 獲勝判斷..................................................................................................... 59
6.7 函數(shù)............................................................................................................ 63
6.7.1 函數(shù)的形式… ……………………………………………………………………… 63
6.7.2 落子函數(shù)… ………………………………………………………………………… 64
6.7.3 獲勝檢測函數(shù)… …………………………………………………………………… 65
07 彈球游戲..........................................................................................69
7.1 對象............................................................................................................ 69
7.2 對象的方法................................................................................................. 70
7.3 定時(shí)功能..................................................................................................... 71
7.4 邊界判斷..................................................................................................... 72
7.5 增加擋板..................................................................................................... 73
7.6 鍵盤交互..................................................................................................... 74
08 貪吃蛇.............................................................................................78
8.1 構(gòu)造函數(shù)..................................................................................................... 78
8.2 原型方法..................................................................................................... 78
8.3 貪吃蛇游戲的框架....................................................................................... 79
8.4 貪吃蛇的移動(dòng).............................................................................................. 80
8.5 貪吃蛇的控制.............................................................................................. 82
8.6 添加蘋果..................................................................................................... 83
8.7 吃蘋果........................................................................................................ 84
8.8 生成新蘋果................................................................................................. 86
8.9 顯示分?jǐn)?shù)..................................................................................................... 87
8.9.1 設(shè)置文本基線… …………………………………………………………………… 90
8.9.2 設(shè)置文本的大小和字體… ………………………………………………………… 91
8.10 游戲結(jié)束................................................................................................... 93
8.11 碰撞檢測................................................................................................... 93
09 拼圖游戲........................................................................................100
9.1 顯示圖片................................................................................................... 100
9.2 圖形的變化............................................................................................... 102
9.3 拼圖游戲說明............................................................................................ 104
9.4 顯示局部圖片............................................................................................ 105
9.5 圖片編號................................................................................................... 107
9.6 移動(dòng)拼圖................................................................................................... 108
9.7 打亂拼圖................................................................................................... 112
9.8 拼圖狀態(tài)判斷............................................................................................ 115
10 飛行射擊游戲................................................................................. 121
10.1 圖片處理................................................................................................. 121
10.2 繪制飛機(jī)................................................................................................. 122
10.3 子彈射擊................................................................................................. 123
11 游戲引擎........................................................................................ 128
11.1 什么是游戲引擎...................................................................................... 128
11.2 Quintus 游戲引擎................................................................................... 128
11.3 網(wǎng)頁初始化............................................................................................. 129
11.4 場景和精靈............................................................................................. 130
11.5 精靈控制................................................................................................. 132
11.6 調(diào)試功能................................................................................................. 133
11.7 GMP 游戲引擎....................................................................................... 135
11.8 js 文件下載............................................................................................. 136
11.9 真·射擊游戲.......................................................................................... 137
11.10 游戲優(yōu)化............................................................................................... 144

本目錄推薦

掃描二維碼
Copyright ? 讀書網(wǎng) ranfinancial.com 2005-2020, All Rights Reserved.
鄂ICP備15019699號 鄂公網(wǎng)安備 42010302001612號