freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

基于j2me的推箱子游戲畢業(yè)設(shè)計論文任務(wù)書-在線瀏覽

2024-09-12 19:40本頁面
  

【正文】 的坐標(biāo),同時該類還承擔(dān)起屏幕的滾動工作。 箱子移動類 BoxThread:負(fù)責(zé)子昂子的無級移動。當(dāng)箱子移動到指定位置時,游戲就會產(chǎn)生過關(guān)事件。 import 。 import 。 import 。 開始 判斷用戶是否按鍵 讀取按鍵信息 輸出新地圖 判斷箱子是否在目標(biāo)上 結(jié)束 過關(guān) 否 是 否 是 9 import 。 public class PushBoxActivity extends Activity{ WeleView weleView = null。//歡迎界面中的移動線程 MenuView menuView = null。//菜單界面中的移動線程 GameView gameView = null。//是否播放聲音 MediaPlayer pushBoxSound。//背景音樂 MediaPlayer winSound。//開始和菜單時的音樂 int map1[][]。//當(dāng)前游戲的地圖 int selectMap = 0。//精靈 KeyThread kt。//鍵盤的狀態(tài) ,二進(jìn)制表示 從左往右表示上下左右 Handler myHandler = new Handler(){//用來更新 UI 線程中的控件 public void handleMessage(Message msg) { if( == 1){//收到 WeleViewGoThread/Wele 發(fā)來的消息 (false)。 } initAndToMenuView()。 10 } initAndToGameView()。 } initAndToMenuView()。 initAndToGameView()。 initAndToGameView()。 public void onCreate(Bundle savedInstanceState) { (savedInstanceState)。 getWindow().setFlags( , )。//推箱子的聲音 winSound = (this, )。//背景音樂 (true)。 (true)。 } public void initAndToWeleView(){ weleView = new WeleView(this)。 } (weleView)。 ()。 (menuView)。 ()。 for(int i=0。 i++){ for(int j=0。 j++){ map1[i][j] = [selectMap][i][j]。 for(int i=0。 i++){ for(int j=0。 j++){ map2[i][j] = [selectMap][i][j]。 mySprite = new MySprite(this)。//添加鍵盤監(jiān)聽 ()。//播放聲音 } (gameView)。 0x37。 0x3B。 0x3D。 0x3E。 } public boolean onKeyDown(int keyCode, KeyEvent event){//鍵盤按下監(jiān)聽 if(keyCode == 19){//上 action = action | 0x08。 13 } if(keyCode == 21){//左 action = action | 0x02。 } return false。 import 。 import 。 import 。 import 。 import 。 WeleViewDrawThread weleViewDrawThread = null。 Bitmap wallLeft。//右面的墻 14 Bitmap iron。//左面的木門 Bitmap woodRight。 Bitmap mountain。//墻的坐標(biāo) int wallLeftY = 10。 int wallRightY = 10。//鐵門的坐標(biāo) int ironY = 10。//木門的坐標(biāo) int woodLeftY = 10。 int woodRightY = 10。 = pushBoxActivity。 weleViewDrawThread = new WeleViewDrawThread(this,getHolder())。 wallLeft = (getResources(), )。 iron = (getResources(), )。 woodRight = (getResources(), )。//背景的水 mountain = (getResources(), )。//背景白色 (background, 0, 0, new Paint())。//后面的山圖片 (wallLeft, wallLeftX, wallLeftY,new Paint())。//墻的右面 (iron, ironX, ironY,new Paint())。//木頭門左面 (woodRight, woodRightX, woodRightY,new Paint())。 (this)。 ()。 (false)。//等待刷幀線程結(jié)束 retry = false。 } } ( 3) 刷幀線程 WeleViewDrawThread 的實現(xiàn) 代碼如下: package 。//睡眠的毫秒數(shù) private boolean flag = true。 PushBoxActivity pushBoxActivity。 } public void setFlag(boolean flag){ = flag。 += 2。 } break。 if(380){ status = 2。 case 2: = 3。 if(90){ status = 3。 case 3: = false。// 向主 activity 發(fā)送Handler 消息 break。//睡眠 } catch(Exception e){ ()。 public class MenuViewGoThread extends Thread{ boolean flag = true。//睡眠的毫秒數(shù) PushBoxActivity pushBoxActivity。 } public void run(){ while(flag){ if( != null){ if( 320){//當(dāng)移動過遠(yuǎn)時將坐標(biāo)重置到 0 = 0。//每次循環(huán)向左移兩個單位 try{ (sleepSpan)。 } } } } } 19 圖三 歡迎界面圖 圖四 菜單界面圖 三. 游戲界面 設(shè)計 在游戲界面設(shè)計中首先要使 菜單界面 MenuView 類 實現(xiàn) 。 import 。 import 。 import 。 import 。//主 Activity 的引用 MenuViewDrawThread menuViewDrawThread。//畫筆 Bitmap start1。//聲音圖片 Bitmap sound2。//游戲說明圖片 Bitmap exit1。//大背景圖片 Bitmap menubackground2。//需要移動的背景的坐標(biāo) public MenuView(PushBoxActivity pushBoxActivity) {//構(gòu)造器 super(pushBoxActivity)。 menuViewDrawThread = new MenuViewDrawThread(this, getHolder())。 paint = new Paint() 。//初始化開始 sound1 = (getResources(), )。//初始化關(guān)閉聲音 help1 = (getResources(), )。//初始化退出 menubackground = (getResources(), )。 } protected void onDraw(Canvas canvas) { (canvas)。//繪制大背景 (menubackground2, 21, 20, paint)。 if(){//根據(jù)聲音的狀態(tài)繪制聲音按鈕圖片 (sound1, 60, 150, paint)。 } (help1, 60, 240, paint)。//繪制退出按鈕 } public boolean onTouchEvent(MotionEvent event) { if(()50 amp。 () 50+() amp。 ()60 amp。 ()60+()){//點(diǎn)擊了開始游戲菜單 if(()){ ()。//向 Activity的 Handler 發(fā)送消息 } else if(()50 amp。 ()50+() amp。 ()70+() amp。 ()70+()+()){ //點(diǎn)擊了聲音菜單 = !。//停止播放聲音 } if(()){ ()。//開始播放聲音 } } } else if(()50 amp。 ()50+() amp。 ()80+()+() amp。 ()80+()+()+()){ //點(diǎn)擊的是游戲說明菜單 } else if(()50 amp。 ()50+() amp。 ()90+()+()+() amp。 ()90+()+()+()+()){ //點(diǎn)擊的是退出游戲菜單 (0)。 } public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { } public void surfaceCreated(SurfaceHolder holder) { (true)。 } public void surfaceDestroyed(SurfaceHolder holder) { boolean retry = true。//停止刷幀線程 23 while (retry) { try { ()。 } catch (InterruptedException e) {//不斷地循環(huán),直到等待的線程結(jié)束 } } } } 基本界面搭建完成,然后繪制線程 MenuViewDrawThread 對菜單界面進(jìn)行刷幀操作。如果希望界面的背景滾動起來,則還需要開發(fā) MenuViewDrawThread 線程類,在該線程類的 run 方法中循環(huán)改變 MenuView 中背景圖片的坐標(biāo)即可。 游戲 界 面設(shè)計 基本框架圖: 圖三 游戲界面設(shè)計基本框架圖 24 ( 5)
點(diǎn)擊復(fù)制文檔內(nèi)容
研究報告相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1