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

正文內(nèi)容

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

2024-07-29 14:50本頁面
  

【正文】 箱子移動到指定位置時,游戲就會產(chǎn)生過關事件。import 。import 。import 。import 。public class PushBoxActivity extends Activity{ WeleView weleView = null。//歡迎界面中的移動線程 MenuView menuView = null。//菜單界面中的移動線程 GameView gameView = null。//是否播放聲音 MediaPlayer pushBoxSound。//背景音樂 MediaPlayer winSound。//開始和菜單時的音樂 int map1[][]。//當前游戲的地圖 int selectMap = 0。//精靈 KeyThread kt。//鍵盤的狀態(tài),二進制表示 從左往右表示上下左右 Handler myHandler = new Handler(){//用來更新UI線程中的控件 public void handleMessage(Message msg) { if( == 1){//收到WeleViewGoThread/Wele發(fā)來的消息 (false)。 } initAndToMenuView()。 } 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。 } if(keyCode == 21){//左 action = action | 0x02。 } return false。import 。import 。import 。import 。import 。 WeleViewDrawThread weleViewDrawThread = null。 Bitmap wallLeft。//右面的墻 Bitmap iron。//左面的木門 Bitmap woodRight。 Bitmap mountain。//墻的坐標 int wallLeftY = 10。 int wallRightY = 10。//鐵門的坐標 int ironY = 10。//木門的坐標 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)。//等待刷幀線程結束 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){//當移動過遠時將坐標重置到0 = 0。//每次循環(huán)向左移兩個單位 try{ (sleepSpan)。 } } } } } 圖三 歡迎界面圖 圖四 菜單界面圖三. 游戲界面設計在游戲界面設計中首先要使菜單界面MenuView類實現(xiàn)。import 。import 。import 。import 。//主Activity的引用 MenuViewDrawThread menuViewDrawThread。//畫筆 Bitmap start1。//聲音圖片 Bitmap sound2。//游戲說明圖片 Bitmap exit1。//大背景圖片 Bitmap menubackground2。//需要移動的背景的坐標 public MenuView(PushBoxActivity pushBoxActivity) {//構造器 super(pushBoxActivity)。 menuViewDrawThread = new MenuViewDrawThread(this, getHolder())。 paint = new Paint() 。//初始化開始 sound1 = (getResources(), )。//初始化關閉聲音 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+()){//點擊了開始游戲菜單 if(()){ ()。//向Activity的Handler發(fā)送消息 } else if(()50 amp。 ()50+() amp。 ()70+() amp。 ()70+()+()){ //點擊了聲音菜單 = !。//停止播放聲音 } if(()){ ()。//開始播放聲音 } } } else if(()50 amp。 ()50+() amp。 ()80+()+() amp。 ()80+()+()+()){ //點擊的是游戲說明菜單 } else if(()50 amp。 ()50+() amp。 ()90+()+()+() amp。 ()90+()+()+()+()){ //點擊的是退出游戲菜單 (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。//停止刷幀線程 while (retry) { try { ()。 } catch (InterruptedException e) {//不斷地循環(huán),直到等待的線程結束 } } }}基本界面搭建完成,然后繪制線程MenuViewDrawThread對菜單界面進行刷幀操作。如果希望界面的背景滾動起來,則還需要開發(fā)MenuViewDrawThread線程類,在該線程類的run方法中循環(huán)改變MenuView中背景圖片的坐標即可。游戲界面設計基本框架圖:圖三 游戲界面設計基本框架圖(5) GameView框架的實現(xiàn)。import 。import 。import 。import 。import 。 GameViewDrawThread gameViewDrawThread。//繪制時第一個的坐標
點擊復制文檔內(nèi)容
試題試卷相關推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1