吃豆人網頁小遊戲製做
測試連接:http://1.yuanxin0427.applinzi.com/%E6%88%90%E5%93%81/index.htmlhtml
遊戲介紹:支持瀏覽器:谷歌、IE等。觸屏操做,點擊屏幕箭頭移動吃豆人吃豆,當吃下全部的豆子時遊戲結束勝利,觸碰到怪物時,角色死亡,吃到大豆子時吃豆人變大,能夠吃怪物
運行截圖瀏覽器
![](http://static.javashuo.com/static/loading.gif)
開發製做軟件:Construct 2服務器
![](http://static.javashuo.com/static/loading.gif)
遊戲開發製做步驟
- 製做背景
- 製做素材(吃豆人、豆子、怪物)
- 導入素材,場景佈置
- 添加運行腳本
- 測試發佈
- 上傳至新浪雲服務器
1、製做背景
使用Microsoft PowerPoint 2010 製做遊戲背景圖app
![](http://static.javashuo.com/static/loading.gif)
2、製做素材
所需素材:oop
- 怪獸gif
- 吃豆人gif
- 大豆
- 小豆
由於遊戲中的gif效果爲逐幀動畫,使用ps自行繪製所需素材的png序列圖,如圖佈局
![](http://static.javashuo.com/static/loading.gif)
3、導入素材 佈置場景
- 建立工程 1.capx
- 添加背景,調節工程和背景至適當大小並將圖層命名爲bg(background)後鎖定
![](http://static.javashuo.com/static/loading.gif)
- 建立sprite吃豆人
- 將吃豆人(player)的png序列導入
![](http://static.javashuo.com/static/loading.gif)
- 設置循環方式loop爲yes
![](http://static.javashuo.com/static/loading.gif)
- 同理導入怪物png序列 大豆 小豆 png序列
![](http://static.javashuo.com/static/loading.gif)
- 建立4個按鈕組件分別爲上下左右,以此控制player的移動
![](http://static.javashuo.com/static/loading.gif)
- 建立牆體!
- 建立文字以用來介紹、打分
- 將素材進行大小的合理縮放並放到合適位置,進行佈局
![](http://static.javashuo.com/static/loading.gif)
- 修改吃豆人和怪物的屬性,使其不能穿越牆體。
![](http://static.javashuo.com/static/loading.gif)
![](http://static.javashuo.com/static/loading.gif)
- 建立完以後的全部組件如圖
![](http://static.javashuo.com/static/loading.gif)
4、添加運行腳本
- 定義兩個全局變量分別爲分數(score)和速度(speed)
![](http://static.javashuo.com/static/loading.gif)
- 添加四個方向鍵按鈕的控制,使按下按鈕時,吃豆人移動,而且方向朝移動方向
![](http://static.javashuo.com/static/loading.gif)
- 建立判斷,判斷吃豆人和怪物的相對位置,使怪物看向吃豆人,而且朝他移動
![](http://static.javashuo.com/static/loading.gif)
- 添加吃豆功能,當吃豆人和都碰撞,score++,豆子destory
![](http://static.javashuo.com/static/loading.gif)
- 當場上的豆子數量小於等於0時,遊戲勝利
![](http://static.javashuo.com/static/loading.gif)
- 添加吃超能豆和吃怪物效果
- 當吃豆人和怪物的距離小於5像素時,吃豆人狀態存活。而且當吃豆人與超能豆碰撞像素小於5像素,即爲吃到超能豆。吃豆人變大,超能豆消失(destory)
![](http://static.javashuo.com/static/loading.gif)
- 設置吃豆人的大小狀態
- 建立吃豆人的 intance variables:isbig(bool)和bigtime(number)
![](http://static.javashuo.com/static/loading.gif)
- 增長無敵狀態爲3秒,並設置吃豆人的大小
![](http://static.javashuo.com/static/loading.gif)
- 運行測試
![](http://static.javashuo.com/static/loading.gif)
5、測試發佈
- 保存爲本地html文件代碼包
![](http://static.javashuo.com/static/loading.gif)
6、上傳發布
- 註冊新浪雲服務帳號,並建立一個新的sae雲應用
![](http://static.javashuo.com/static/loading.gif)
- 建立新版本1
![](http://static.javashuo.com/static/loading.gif)
- 上傳本地代碼包
![](http://static.javashuo.com/static/loading.gif)
- 進入雲調試,打開index.html文件
![](http://static.javashuo.com/static/loading.gif)
- 獲取url
![](http://static.javashuo.com/static/loading.gif)
- 使用草料二維碼將連接生成爲二維碼
完成!