導航:首頁 > 源碼編譯 > 安卓回合游戲源碼

安卓回合游戲源碼

發布時間:2023-05-14 03:20:23

A. 求一個安卓開發小游戲源代碼,臨時交作業用

package com.fiveChess;

import android.app.Activity;
import android.os.Bundle;
import android.view.Display;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Window;
import android.view.WindowManager;

public class MainActivity extends Activity {
GameView gameView = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
Display display = this.getWindowManager().getDefaultDisplay();
gameView = new GameView(this,display.getWidth(),display.getHeight());
setContentView(gameView);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu.add("重新開始").setIcon(android.R.drawable.ic_menu_myplaces);
menu.add("退出");
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if(item.getTitle().equals("重新開始")){
gameView.canPlay = true;
gameView.chess = new int[gameView.row][gameView.col];
gameView.invalidate();
}else if(item.getTitle().equals("退出")){
finish();
}
return super.onOptionsItemSelected(item);
}
}

package com.fiveChess;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.view.MotionEvent;
import android.view.View;

public class GameView extends View {
Context context = null;
int screenWidth,screenHeight;
String message = "";//提示輪到哪個玩家
int row,col; //劃線的行數和列數
int stepLength = 30;//棋盤每格間距
int[][] chess = null;//0代表沒有棋子,1代表是黑棋,2代表白旗
boolean isBlack = true;
boolean canPlay = true;
public GameView(Context context,int screenWidth,int screenHeight) {
super(context);
this.context = context;
this.screenWidth = screenWidth;
this.screenHeight = screenHeight;
this.message = "黑棋先行";
row = (screenHeight-50)/stepLength+1;
col = (screenWidth-10)/stepLength+1;
chess = new int[row][col];

}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
Paint paint = new Paint();
paint.setColor(Color.WHITE);
canvas.drawRect(0, 0, screenWidth, screenHeight, paint);//畫背景
paint.setColor(Color.BLUE);
paint.setTextSize(25);
canvas.drawText(message, (screenWidth-100)/2, 30, paint);//畫最頂層的字
paint.setColor(Color.BLACK);
//畫棋盤
for(int i=0;i<row;i++){
canvas.drawLine(10, 50+i*stepLength, 10+(col-1)*stepLength, 50+i*stepLength, paint);
}
for(int i=0;i<col;i++){
canvas.drawLine(10+i*stepLength,50,10+i*stepLength,50+(row-1)*stepLength, paint);
}

for(int r=0;r<row;r++){
for(int c=0;c<col;c++){
if(chess[r][c] == 1){
paint.setColor(Color.BLACK);
paint.setStyle(Style.FILL);
canvas.drawCircle(10+c*stepLength, 50+r*stepLength, 10, paint);
}else if(chess[r][c] == 2){
//畫白棋
paint.setColor(Color.WHITE);
paint.setStyle(Style.FILL);
canvas.drawCircle(10+c*stepLength, 50+r*stepLength, 10, paint);

paint.setColor(Color.BLACK);
paint.setStyle(Style.STROKE);
canvas.drawCircle(10+c*stepLength, 50+r*stepLength, 10, paint);
}
}
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if(!canPlay){return false;}
float x = event.getX();
float y = event.getY();
int r = Math.round((y-50)/stepLength);
int c = Math.round((x-10)/stepLength);
if(r<0 || r>row-1 || c<0 || c>col-1){return false;}
if(chess[r][c]!=0){return false;}//若有棋子則不再畫棋子了
if(isBlack){
chess[r][c] = 1;
isBlack = false;
message = "輪到白棋";
}else{
chess[r][c] = 2;
isBlack = true;
message = "輪到黑棋";
}
invalidate();
if(judge(r, c,0,1)) return false;
if(judge(r, c,1,0)) return false ;
if(judge(r, c,1,1)) return false;
if(judge(r, c,1,-1)) return false;

return super.onTouchEvent(event);
}
private boolean judge(int r, int c,int x,int y) {//r,c表示行和列,x表示在y方向上的偏移,y表示在x方向上的偏移
int count = 1;
int a = r;
int b = c;
while(r>=0 && r<row && c>=0 && c<col && r+x>=0 && r+x<row && c+y>=0 && c+y<col && chess[r][c] == chess[r+x][c+y]){
count++;
if(y>0){
c++;
}else if(y<0){
c--;
}
if(x>0){
r++;
}else if(x<0){
r--;
}
}
while(a>=0 && a<row && b>=0 && b<col && a-x>=0 && a-x<row && b-y>=0 && b-y<col && chess[a][b] == chess[a-x][b-y]){
count++;
if(y>0){
b--;
}else if(y<0){
b++;
}
if(x>0){
a--;
}else if(x<0){
a++;
}
}
if(count>=5){
String str = "";
if(isBlack){
str = "白棋勝利";
}else{
str = "黑棋勝利";
}
new AlertDialog.Builder(context).setTitle("游戲結束").setMessage(str).setPositiveButton("重新開始", new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface dialog, int which) {
chess = new int[row][col];
invalidate();

}
}).setNegativeButton("觀看棋局", new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface dialog, int which) {
canPlay = false;

}
}).show();
return true;
}

return false;
}
}
PS:五子棋,無需圖片,直接在程序里畫出來的。注意我發的是兩個文件,一個activity,一個類文件,別把它當成一個文件了

B. 求:手機軟體源代碼!

其實這里有很多的:

[gnokii-0.3.2.tar.gz]
Nokia手機工具程序。可以管理手機的電話薄,發送/接收短消息,查看電池狀態等 (2001-02-14, UNIX, 731KB, 2130次)

[smslink-0.44b.tar.gz]
手機短消息服務的伺服器和客戶端 (2001-01-08, LINUX, 91KB, 1883次)

[移動簡訊SMS綜合資料庫.rar]
短消息基礎知識;短消息的信息處理流程及其分析、解決問題的方法;手機簡訊息SMS開發—編碼,解碼;PDU介紹;短消息的體系結構等 (2005-09-28, CHM, 1009KB, 1536次)

[nle-0.0.1-2.tgz]
可以修改Nokia手機的logo圖標的程序 (2001-02-14, LINUX, 21KB, 1442次)

[是男人就下一百層SHY.rar]
製作的第一款休閑類的手機游戲,適合初學者參考 (2005-06-15, java, 484KB, 1357次)

[sms_client-2.0.7k.tgz]
使用TAP的蜂窩型GSM手機短消息服務中心 (2001-01-08, LINUX, 82KB, 1333次)

[mobile_sms.zip]
使用手機發送短消息的編程方法 (2001-11-21, HTML, 5KB, 1174次)

[kvanttisms-src-0.5.tgz]
Java寫的通過手機收發簡訊息的程序。 (2001-11-20, Java, 10KB, 1049次)

[BREW開發-海信(王宏兵).rar]
深入研究BREW手機游戲開發———— 王洪信開發者最好的初學資料 (2005-09-26, Visual C++, 7229KB, 841次)

[jSMSEngine_2_0_4.zip]
開源的手機簡訊開發包!包括例子程序和比較詳細的文檔,還有開發者的網站!來源於sourceforge! (2006-01-21, Java, 438KB, 729次)

[qrcode_js.zip]
手機內嵌二維條碼圖像識別的JAVA的源程序,強烈推薦下載。 (2006-01-14, Java, 2210KB, 677次)

[gprs_sms.zip]
一個用COM或USB介面連接gsm/gprs手機進行簡訊收發的程序,用到的是simense的通訊模塊 (2003-02-20, Visual C++, 97KB, 629次)

[PaoPao.rar]
j2me手機泡泡龍游戲。寫得不錯還未完工的版本。不過可以用來學習。 (2005-03-04, Java, 83KB, 613次)

[MakeMap.rar]
用java寫的地圖編輯器,可用於j2me手機游戲的地圖編輯。 (2005-03-04, Java, 26KB, 606次)

[J2mebox.rar]
一個類似打地鼠的j2me手機游戲。 (2005-03-04, Java, 58KB, 521次)

[shoujihaomachaxun.rar]
輸入手機號碼可查詢:歸屬地址、手機號碼、區號、所屬卡型 (2006-06-05, Java, 686KB, 520次)

[rich_man+src.rar]
大富翁手機游戲。 (2005-03-04, Java, 269KB, 513次)

[gsmssend-1.6.tar.gz]
通過網站發送手機簡訊息的程序。需要GNOME/GTK支持 (2001-11-20, LINUX, 352KB, 498次)

[MTKstart.rar]
台灣聯發(MTK)手機晶元資料,可作為手機應用的平台 (2007-08-09, C-C++, 118KB, 495次)

[C# 發簡訊.rar]
使用C#發簡訊,連接Modem或者手機,通過串口發送簡訊, (2004-06-30, CSharp, 437KB, 469次)

[WindowsMobile5.0.rar]
Windows Mobile 5.0 三十幾個經典手機軟體開發源碼希望對大家有幫助. (2006-08-30, CSharp, 578KB, 449次)

[motorola_RingerToneFormat.zip]
motorola手機鈴聲格式文檔 (2002-06-07, PDF, 45KB, 445次)

[ksiemens-0.1.tar.gz]
KDE下的西門子手機管理程序,如圖標,電話薄,簡訊息等管理 (2001-11-21, LINUX, 3437KB, 444次)

[nec麻將.rar]
一個java編的小游戲.對初學手機游戲編程的人很有用啊. (2005-06-07, Java, 50KB, 434次)

[nokiacomposer.src.zip]
Nokia手機語音管理程序,如上載音樂等。 (2001-11-21, Visual C++, 315KB, 422次)

[SmartMessagingFAQ.zip]
諾基亞手機圖片鈴聲開發文檔 (2002-06-07, PDF, 23KB, 410次)

[motolora_smscertguide.zip]
motorola手機簡訊息開發文檔 (2002-06-07, PDF, 134KB, 400次)

[MV100-0.1.rar]
是一個手機功能的模擬程序,從界面到功能都做了很好的模擬 (2005-07-29, C-C++, 14630KB, 384次)

[helix.src.0812.rar]
著名的 helix realplayer 基於手機 symbian 系統的 播放器全套源代碼,內含編譯工具、以及配套相關軟體:WinCVS、Python等。花了近一個多月才整理完成,是非常難得的全套代碼。 (2005-05-19, C++, 43787KB, 373次)

[eluosi方塊.rar]
經典的手機游戲源碼俄羅斯方塊,基於C+Brew開發 (2005-07-14, C-C++, 425KB, 373次)

[MTK2.rar]
這是我上傳MTK手機開發的一些資料2,這兩天起上傳6份資料,全部是手開發的。希望對你們有用。 (2007-04-13, C-C++, 5859KB, 371次)

[resource]
壓縮包中一個為一般操作系統下的fft,一個是手機或類似設備中的T9拼音輸入法 (2003-08-05, C-C++, 53KB, 359次)

[SeaHorse.rar]
手機游戲,畫面效果還可以,可以作為手機游戲入門參考 (2005-06-15, Java, 273KB, 356次)

[nec 打飛機.rar]
一個JAVA編的小游戲,對初學手機游戲的人很有幫助. (2005-06-07, Java, 73KB, 335次)

[多級菜單.rar]
/*[原創]一個樹形多級菜單參考程序 這是一個用於車載電話的菜單程序,可以看成是手機功能菜單的簡化板. 我所認為的樹形多級菜單是指:在一個父菜單項目下面有多個子菜單, 子菜單下面又有多個孫菜單...,進入下層菜單主要依*當前選中的索引.有點象文件的目錄結構. 本木從前實現這類的菜單主要*分層的switch語句,每層都是一個switch.但當我看到曉奇大俠的 程序和耳朵灌滿lq等人的爭論後,那時那地,我的心境變化了,我意識到指針代表了先進的生產力, 代表了社會的發展方向,是建設和諧社會的必要條件.不管你用了多長時間C語言,只要你不善於用 一個小針指來指去,你就是那種"用嘴吃飯的高貴騎士,決不用屁股裝彈步槍"的守舊分子和社會發 展的絆腳石.(跑題太遠,刪去1萬字...打住) .言歸正傳,下面的程序適用CPU為Mega16,編譯器為CVAVR 1.24.4a 由於按鍵數目較多,所以按鍵程 序把按鍵事件分為數字鍵,快捷鍵,確認鍵,取消鍵,上下翻鍵幾類,以減小菜單結構的容量.一下菜單 數據在菜單結構數組中的偏移量,有多少個菜單象就有多少個宏定義*/ (2005-08-02, C-C++, 2KB, 334次)

[與小靈通訊的軟體.zip]
手機的通訊,特別是小靈通的通訊,是非常難得的技術,也是很受歡迎的,快下啊! (2005-09-30, Visual C++, 39KB, 324次)

[C16漢字輸入方案.rar]
「C16漢字輸入方案」,是針對小鍵盤設備(如手機、遙控器等)通常為16個基本鍵(「0」到「9」、「*」、「#」、左右鍵、刪除鍵、確認鍵)的情況,充分發掘16個鍵位條件下進行漢字輸入和符號輸入的潛力,使漢字、英文、數字輸入達到盡可能高的效率,是在16鍵的小鍵盤設備進行漢字輸入的優秀方案。 (2005-10-27, C++ Builder, 76KB, 316次)

[CDMA短消息發送程序.zip]
用vc開發的cdma手機模塊收發簡訊的功能,主要部分是串口通信和gb->unicode碼間的轉換。 (2005-12-08, Visual C++, 193KB, 313次)

C. 修改安卓游戲的源碼

您好,

如果源碼沒有加密的話,

您可以使用反編譯軟體將您的游戲進行反編譯

在騰訊電腦管家——軟體倉庫中有多款反編譯軟體

您可以選擇合適的反編譯軟體,修改源碼後重新簽名打包

推薦使用【改之理】傻瓜式操作

希望可以幫到您,望採納
騰訊電腦管家企業平台:http://..com/c/guanjia/

D. 手機游戲怎麼找源碼 不懂讓道

這個游戲的馬源一般是找不到的,會製作的才可以!

你可以下載了游戲的apk,改後綴壓縮在解壓,在裡面找找吧!

然後手機的手機游戲apk什麼的,最好在應用寶裡面下載

在手機上打開應用寶軟體搜索你所需要游戲,找到下載就可以了。

也可以通過手機連接電腦端的應用寶軟體來下載的,打開PC端的應用寶軟體——手機應用。

可以通過搜索你所需要的游戲進行下載呢,都是很方便的。還望採納

E. 安卓源代碼怎麼用

網上給的android源代碼怎麼用?
git的工程裡面不是都有英文的readme么,File -> import先瀏覽到目錄到library,導入library,然後,瀏覽到samples目錄導入samples,結束。

我總共就花了兩分鍾下載導入,build,截圖,發帖回答。
我在網上下了一些Android的源代碼,不知道怎麼用Eclipse運行
file>import> 輸入android 下一步 把你的項目導進去就好了
安卓源碼怎麼用
是import 然後選android 導入整個目錄就行了

下載的安卓源碼怎麼用? 20分
如果是用的ecilipse,在file裡面有個import,剩下的操作可以看這個鏈接

blogs/...9
一個android的源程序怎樣用eclipse打開
用eclipse的import功能將其導入,就可拆帶以打開了
android軟體開發 怎麼讀懂一個android源代碼
一開始都會感覺到疑惑,網路上,論壇上,甚至是書本上都講不清楚,不知道這是什麼原因,我想人類的私心在裡面會占據很大的因素。

不是每個人都願意分享自己辛苦得來的經驗和心得。

android軟體,你可以這么看,它是用java語言+很觸很多的現成的已經被別人寫到的包組合成的。

其實它的本質就是java,然後那些慎旦界面什麼,其實核心就是一個叫做XML的東西。

這個XML其實也沒什麼神秘,就是一個國際化的,標準的標簽。

然後標簽其實說白了就是記號,你在這個XML文件裡面,按照谷歌給你定好的游戲規則,寫標簽,然後這個標簽會被自動解析成相應功能。

整個android界面其實就是一個XML文件,android表面上的東西幾乎都是XML文件組成的,旅孝蘆剩下的核心程序邏輯,其實就是java程序。

再換句話說,你可以在java上把程序邏輯寫好,然後單獨寫個XML文件,然後合並起來,就是android
java問題。安卓手機源代碼怎麼運行
既然你安裝了eclipse那你就可以配置sdk環境,然後建一個android project,把你的源代碼放進去,選擇在你自己的手機上運行就會自動安裝到你手機上了。嫌麻煩的話可以發給我,我幫你運行一下直接給你app文件
如何打開android 源代碼
導入工程文件,就是文件下的Import,打開導入面板後選擇已經存在的項目,在第二項裡面,然後定擇你項目的文件夾即可,eclipse會自動掃描
怎樣著手研究 Android 源代碼
一、源碼里的工程需要導入所有的Android源碼,不可以單獨作為一個Android工程導入到Eclipse里。

二、使用git和repoAndroid的源代碼,參考如下步驟

以下操作都是在Ubuntu10.04LTS下完成:

1)安裝git

sudo apt-get install git-core

2)安裝curl

sudo apt-get install git-core curl

3)安裝Repo,為了方便直接repo到用戶根目錄中。通過curlrepo
安卓游戲中的源代碼有什麼用,是如何編寫和解析的
會java語言么?不會的話跟你解釋也是扯淡

F. 游戲軟體怎麼查看源代碼

源代碼是看不成的,因為游戲軟體打包好做成app的話,是沒法看源碼的,雖然存在一些特殊情況下,我們可以推測出exe程序是用什麼程序寫的。但是多數情況下,我們是無法只根據一個exe程序就判斷出來的。

根據exe程序我們是無法直接得到程序的源碼的。雖然也有一些用於逆向工程的辦法,但那不可能把已經是exe的程序反回到它原始的源碼情況。而且這些工具都很難用。你可以用「反編譯」搜到很多工具,但是說實話,即便是這方面的專家,要看懂反編譯以後的程序也不是一件輕松的事情。

G. 開發手游的代碼

4.1游戲的的思路、構想
4.1.1游戲想法的產生
相信大家一定都在8位機機上玩過《冒險島》這款游戲,非常有趣味性。
游戲中玩家通過不斷的闖關,來解救公主。在每個關都很很多的怪物阻擋著你,所以需要運用各種機關或者秘籍來殺死它們。殺死他們的同時還可以獲得各種獎勵,加生命,加血等,增加了游戲的趣味性。

如圖2所示:

這款《冒險島》游戲的實現相對於其他RPG或者網路版手機游戲稍簡單一些,適合初學者作為練習,所以我決定編寫一款類似的手機游戲。
由於之前對手機游戲的編程知識以及游戲的設計只有初步的了解,因此,我們在游戲的構架和思路上經歷了幾個階段。

這款《冒險島》游戲的實現相對於其他RPG或者網路版手機游戲稍簡單一些,適合初學者作為練習,所以我決定編寫一款類似的手機游戲。

由於之前對手機游戲的編程知識以及游戲的設計只有初步的了解,因此,我們在游戲的構架和思路上經歷了幾個階段。

4.1.2對游戲設計的初步認識
剛開始我們只對J2ME有初步的了解。這時我們只是模仿之前在PC上看到的游戲,用語言把游戲的實現感性的描述為幾大部分:

游戲界面系統:包括游戲開始界面;游戲開局界面;游戲運行界面;游戲結束界面。

游戲元素:菜單類;畫布類;人物類;排行榜類。

4.1.3模塊成型階段
在進一步熟悉了J2ME知識後,對框架做出了一些修改,逐步把游戲的基本功能確定。游戲依次進入載入界面;主菜單;游戲運行界面;游戲結束界面。

具體實現的功能為:

1.主菜單,有如下選項:

(1)開始游戲——進入游戲界面。

(2)聲音——設置聲音的有無選項。

(3)幫助——介紹游戲的玩法。

(4)排行榜——玩家所得分數的排行榜。

(5)關於——用來顯示說明信息以及背景圖片。

2.游戲運行界面,包括:

游戲界面;目前游戲得分;游戲關數;生命次數;

3.游戲結束界面:游戲結束後,顯示一行說明信息,然後退回到菜單。

游戲的主要模塊為:

1.游戲主MIDlet(GameMIDlet)——對游戲生命周期的判斷;對畫布類的調用;管理游戲程序中各個屏幕之間的轉換。
2.游戲畫布(MyGame)——對游戲所用變數,常量的設定;游戲的初始化;游戲中精靈運動軌跡的控制;精靈與磚塊的碰撞檢測以及磚塊狀態的控制;游戲中各關卡的基本設定;游戲中對按鍵狀態的處理。

3.菜單類——游戲中菜單事件的處理。

4.GameOgre類——游戲中怪物的類。

5.GamePlayer類——玩家控制的精靈類。

6.GameRMS類——用於實現分數排行榜。

7.PlayMusic類——用於實現音樂的播放。

8.MySet類——聲音大小的設置。

4.2 程序的類結構
程序一共有8個主要類,其中菜單類負責各個屏幕的切換。程序的類結構如圖3所示:

4.3 游戲的流程圖
進入游戲菜單。初始情況下,游戲菜單有5個選項,它們分別是開始游戲、游戲說明和排行榜、設置、關於。選擇開始新游戲則進入游戲,在游戲中如果按下非游戲鍵則中斷游戲返回菜單,此時菜單中增加了一個繼續游戲的選項,可以返回遊戲也可以重新開始新的游戲。在菜單中選擇游戲說明或者高分記錄,則進入相應的屏幕,他們都能用「後退」軟鍵返回菜單。菜單中的退出選項用於退出程序。游戲的流程如圖4所示:

4.4.1主類GameMIDlet的實現
MIDlet是最核心的類。MIDlet程序有三種狀態:
1.暫停狀態

2.運行狀態

3.銷毀狀態

J2ME程序都是從MIDlet類開始執行,系統在執行MIDlet程序時,首先構造一個MIDlet類型的對象,然後使程序進入到暫停狀態,按照生命周期的規定,系統會自動調用MIDlet對象的startApp方法使程序進入到運行狀態,開始程序的執行。

下圖是運行時顯示的畫布對象:

首先,先要創建MIDlet類型的對象,下面我們來看對象的構造方法:
//主程序構造方法
public GameMIDlet()
{
rs = null;
RecordName = 「GameRMS」;
GameMenu.display = Display.getDisplay(this) ;
GameMenu.midlet = this;
}

java
開發語言
oppo手機型號及價格
精選推薦
廣告

JAVA基於J2ME的手機游戲開發(文檔+源代碼).zip
0下載·0評論
2022年1月27日
JAVA基於J2ME的手機游戲開發免費
717閱讀·0評論·0點贊
2022年8月23日
JAVA五子棋手機網路對戰游戲的設計與實現(源代碼+論文)
568閱讀·2評論·0點贊
2022年12月5日
J2ME手機游戲引擎程序結構簡述
170閱讀·0評論·0點贊
2021年9月12日
最新45款Java手機游戲開發源代碼免費下載
10下載·0評論
2019年3月4日
經典50個Java手機游戲源碼.7z
3下載·0評論
2022年7月8日
無敵版游戲下載

精選推薦
廣告
java手機小游戲源碼_Java手機版數獨小游戲(J2me)JAVA游戲源碼下載
435閱讀·0評論·0點贊
2021年3月14日
java 300行代碼 冒險闖關小游戲(代碼+講解)
2637閱讀·1評論·6點贊
2022年9月9日
java俄羅斯方塊代碼_【俄羅斯方塊java】分享一個Java寫的俄羅斯方塊源碼 演算法簡單(300行) 注釋詳細!...
304閱讀·0評論·0點贊
2021年3月5日
java小游戲源碼_分享幾款java小游戲源碼
4921閱讀·0評論·4點贊
2021年3月5日
java手機游戲開發如何_用JAVA開發手機游戲需要如何構建開發環境?
1209閱讀·0評論·0點贊
2021年2月26日
《精通Java手機游戲與應用程序設計》源碼
35閱讀·0評論·0點贊
2022年3月24日
java怎麼製作游戲,看完這篇徹底明白了
4803閱讀·0評論·2點贊
2021年6月29日
泡泡堂代碼 JAVA_Java手機游戲泡泡堂源碼
566閱讀·0評論·1點贊
2021年3月14日
十款經典游戲的Java版本(開源)
19.0W閱讀·95評論·214點贊
2014年12月7日
飛翔的小鳥--Java小游戲實戰(代碼完整)
1.1W閱讀·13評論·50點贊
2021年4月5日
Vue——獲取後端json數據中的URL並通過按鈕跳轉到此URL
1683閱讀·4評論·0點贊
2021年2月5日
java安卓游戲源碼下載_77個安卓游戲 android源碼
801閱讀·0評論·0點贊
2021年3月15日
去首頁
看看更多熱門內容

H. 誰有手機安卓游戲的源代碼

網路搜「游姿搜戲源碼-Android
ligotop」,
ligotop這個網站搏侍有很多安卓源碼,包括游戲源碼。跡銀歷

I. 誰能給我一個手機游戲的源代碼啊

這個地址也有,不過直接給你吧,這樣比較好
先給你看看主要的類吧

package Game;

import DreamBubbleMidlet;

import java.io.IOException;
import java.util.Enumeration;
import java.util.Hashtable;

import javax.microedition.lci.Graphics;
import javax.microedition.lci.Image;
import javax.microedition.lci.game.GameCanvas;
import javax.microedition.lci.game.LayerManager;
import javax.microedition.lci.game.Sprite;

public class Game extends GameCanvas implements Runnable {

protected DreamBubbleMidlet dreamBubbleMidlet;

protected Graphics g;
protected Image loadingImage;
protected Image pauseImage;
protected Image cursorImage;
protected Image jackStateImage;
protected Image johnStateImage;
protected Image numberImage;

protected Sprite cursor;
protected Sprite number;
protected LayerManager cursorManager;
protected LayerManager numberManager;

protected Hashtable bombTable;
protected Map map;
protected LayerManager gameLayerManager;
protected Role player;
protected Sprite playerGhost;

protected int screenWidth;
protected int screenHeight;
protected int delay = 50;
protected int[][] bornPlace;
protected int chooseIndex;
protected int stageIndex = 1;
protected int gameClock;
protected int loadPercent;

protected boolean isPause;
protected boolean isEnd;
protected boolean isPlaying;
protected boolean isLoading;

protected Thread mainThread;

public Game(DreamBubbleMidlet dreamBubbleMidlet) {
super(false);
this.setFullScreenMode(true);
this.dreamBubbleMidlet = dreamBubbleMidlet;

this.screenWidth = this.getWidth();
this.screenHeight = this.getHeight();

try {
this.loadingImage = Image.createImage("/Game/Loading.png");
this.pauseImage = Image.createImage("/Game/Pause.png");
this.cursorImage = Image.createImage("/Game/Cursor.png");
this.jackStateImage = Image.createImage("/State/JackState.png");
this.johnStateImage = Image.createImage("/State/JohnState.png");
this.numberImage = Image.createImage("/State/Number.png");
} catch (IOException e) {
e.printStackTrace();
}

this.g = this.getGraphics();
}

public void loadStage(int stage) {
this.isEnd = false;
this.isPause = false;
this.isPlaying = false;
this.gameLayerManager = new LayerManager();
this.cursorManager = new LayerManager();
this.numberManager = new LayerManager();
this.bombTable = new Hashtable();
this.cursor = new Sprite(this.cursorImage, 32, 32);
this.number = new Sprite(this.numberImage, 12, 10);
this.loadPercent = 20;
sleep();

loadMap(stage);
this.loadPercent = 40;
sleep();

loadPlayer();
this.loadPercent = 60;
sleep();

this.gameLayerManager.append(map.getBombLayer());
this.gameLayerManager.append(map.getBuildLayer());
this.gameLayerManager.append(map.getToolLayer());
this.gameLayerManager.append(map.getFloorLayer());
this.gameLayerManager.setViewWindow(0, -5, screenWidth,
Global.MAP_HEIGHT + 5);
this.cursorManager.append(cursor);
this.numberManager.append(number);
this.loadPercent = 80;
sleep();

this.loadPercent = 100;
sleep();
isPlaying = true;
}

public void run() {
while (!isEnd) {
long beginTime = System.currentTimeMillis();
this.drawScreen();
long endTime = System.currentTimeMillis();
if (endTime - beginTime < this.delay) {
try {
Thread.sleep(this.delay - (endTime - beginTime));
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}

public void loadMap(int stage) {
switch (stage) {
case 0:
this.map = new Map(Global.MAP_BLOCK);
this.bornPlace = Global.MAP_BLOCK_BORNPLACE;
break;
case 1:
this.map = new Map(Global.MAP_FACTORY);
this.bornPlace = Global.MAP_FACTORY_BORNPLACE;
break;
case 2:
this.map = new Map(Global.MAP_FOREST);
this.bornPlace = Global.MAP_FOREST_BORNPLACE;
break;
case 3:
this.map = new Map(Global.MAP_PIRATE);
this.bornPlace = Global.MAP_PIRATE_BORNPLACE;
break;
case 4:
this.map = new Map(Global.MAP_FAUBOURG);
this.bornPlace = Global.MAP_FAUBOURG_BORNPLACE;
break;
}
}

public void loadPlayer() {
this.player = SingleGameRole.createSingleGameRole(this, Global.JACK,
this.bornPlace[0][0], this.bornPlace[0][1]);
this.gameLayerManager.append(player);
try {
this.playerGhost = new Sprite(Image.createImage("/Character/Jack.png"),
this.player.width, this.player.height);
this.gameLayerManager.append(playerGhost);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

public void playerUpdate() {
if(!this.player.isAlive)
this.playerGhost.setVisible(false);
this.playerGhost.setFrame(this.player.getFrame());
this.player.updateRole();
}

public void bombUpdate() {
Enumeration enu = this.bombTable.keys();
while (enu.hasMoreElements()) {
String key = (String) enu.nextElement();
Bomb bomb = (Bomb) (bombTable.get(key));

if (bomb.isvisable) {
bomb.update();
} else {
bombTable.remove(key);
bomb = null;
}
}
}

public void mapUpdate() {
this.map.update();
}

public void drawScreen() {
if (gameClock < 10000)
gameClock++;
else
gameClock = 0;
if (!this.isLoading) {
if (!isPause) {
this.operate();
this.bombUpdate();
this.playerUpdate();
this.mapUpdate();
g.setColor(0x000000);
g.fillRect(0, 0, getWidth(), getHeight());
this.drawState();
gameLayerManager.paint(g, 0, this.screenHeight
- Global.MAP_HEIGHT - 5);
} else {
this.drawPauseFrame();
}
} else {
this.drawLoadingFrame();
}
this.flushGraphics();
}

public void drawFailScreen() {

}

public void drawState() {
if (this.player.type == Global.JACK) {
g.drawImage(jackStateImage, 60, 5, Graphics.TOP | Graphics.LEFT);
}
if (this.player.type == Global.JOHN) {
g.drawImage(johnStateImage, 60, 5, Graphics.TOP | Graphics.LEFT);
}

this.number.setFrame(this.player.bombNums);
this.numberManager.paint(g, 101, 15);
this.number.setFrame(this.player.speed);
this.numberManager.paint(g, 133, 15);
this.number.setFrame(this.player.power);
this.numberManager.paint(g, 165, 15);
}

protected void drawPauseFrame() {
g.setColor(0x000000);
g.fillRect(0, 0, getWidth(), getHeight());
this.drawState();
if (gameClock % 5 == 0)
this.cursor.setFrame((this.cursor.getFrame() + 1) % 4);
this.gameLayerManager.paint(g, 0, this.screenHeight - Global.MAP_HEIGHT
- 5);
this.cursorManager.paint(g, screenWidth / 2 - pauseImage.getWidth() / 2
- 32, screenHeight / 2 - pauseImage.getHeight() / 2
+ this.chooseIndex * 33 + 24);
g.drawImage(pauseImage, screenWidth / 2, screenHeight / 2,
Graphics.HCENTER | Graphics.VCENTER);
}

protected void drawLoadingFrame() {
g.setColor(66, 70, 246);
g.fillRect(0, 0, screenWidth, screenHeight);

g.drawImage(loadingImage, screenWidth / 2, 2 * screenHeight / 5,
Graphics.HCENTER | Graphics.VCENTER);

g.setColor(0, 255, 0);
g.fillRect((screenWidth - 120) / 2, 2 * screenHeight / 3,
(this.loadPercent * 120) / 100, 10);

g.setColor(255, 0, 0);
g.drawRect((screenWidth - 120) / 2, 2 * screenHeight / 3, 120, 10);
}

public void showMe() {
new Loading(this.stageIndex);
if (this.mainThread == null) {
mainThread = new Thread(this);
mainThread.start();
}
this.dreamBubbleMidlet.show(this);
}

public void operate() {
int keyStates = getKeyStates();
this.playerGhost.setPosition(this.player.xCoodinate, this.player.yCoodinate);
if ((keyStates & DOWN_PRESSED) != 0) {
this.player.walk(Global.SOUTH);
} else {
if ((keyStates & UP_PRESSED) != 0) {
this.player.walk(Global.NORTH);
} else {
if ((keyStates & RIGHT_PRESSED) != 0) {
this.player.walk(Global.EAST);
} else {
if ((keyStates & LEFT_PRESSED) != 0) {
this.player.walk(Global.WEST);
}
}
}
}
}

protected void keyPressed(int key) {
if (!this.isPlaying)
return;
if (!this.isPause && key == -7) {// 右鍵
this.chooseIndex = 0;
this.pauseGame();
return;
}
if (key == 35) {// #鍵
this.nextStage();
return;
}
if (key == 42) {// *鍵
this.preStage();
return;
}
if (this.isPause) {
switch (key) {
case -1:
case -3:
if (this.chooseIndex == 0)
this.chooseIndex = 2;
else
this.chooseIndex = (this.chooseIndex - 1) % 3;
break;
case -2:
case -4:
this.chooseIndex = (this.chooseIndex + 1) % 3;
break;
case -5:// 確認鍵
case -6:// 左軟鍵
switch (chooseIndex) {
case 0:
this.continueGame();
break;
case 1:
this.restart();
break;
case 2:
this.endGame();
break;
}
break;
default:
break;
}
} else {
switch (key) {
case 53:
case -5:// 確認鍵
this.player.setBomb(this.player.getRow(), this.player.getCol());
break;
}
}
}

public void restart() {
new Loading(this.stageIndex);
}

public void continueGame() {
this.isPause = false;
this.player.play();
}

public void pauseGame() {
this.isPause = true;
this.player.stop();
}

public void endGame() {
this.isEnd = true;
this.mainThread = null;
System.gc();
try {
Thread.sleep(500);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
this.dreamBubbleMidlet.menu.showMe();
}

public void nextStage() {
if (this.stageIndex < 4) {
this.stageIndex++;
}
new Loading(this.stageIndex);
}

public void preStage() {
if (this.stageIndex > 0) {
this.stageIndex--;
}
new Loading(this.stageIndex);
}

class Loading implements Runnable {
private Thread innerThread;
private int stageIndex;

public Loading(int stageIndex) {
this.stageIndex = stageIndex;
innerThread = new Thread(this);
innerThread.start();
}

public void run() {
isLoading = true;
loadPercent = 0;
System.gc();
loadStage(stageIndex);
isLoading = false;
}
}

public void sleep() {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}

這個是游戲主體類

下面是游戲的人物類

package Game;

import javax.microedition.lci.Image;
import javax.microedition.lci.game.Sprite;

public abstract class Role extends Sprite {

/**
* 人物的基本屬性
*/
protected int type;
protected int xCoodinate;
protected int yCoodinate;
protected int row;
protected int col;
protected int width;
protected int height;
protected int speed;
protected int status;
protected boolean isCanOperate = false;
protected boolean isAlive = true;

/**
* 人物放置炸彈的基本屬性
*/
protected int power;
protected int bombNums;

protected int characterClock = 0;
protected int deadTime = 0;

protected Game game;

protected Role(Image image, int width, int Height, Game game) {
super(image, width, Height);
this.game = game;
}

/**
* 人物拾起道具
* @param tool
*/
public abstract void pickupTool(int tool);
/**
* 碰撞檢測以及坐標的改變,如果對行走條件有特殊需求,既可以在這里寫自己的條件
* @param direction
*/
public abstract void collisionCheck(int direction);

public void updateRole() {
if (this.characterClock < 10000) {
this.characterClock++;
} else {
this.characterClock = 100;
}

int row = this.getRow();
int col = this.getCol();

if (this.isAlive) {

int tool = this.game.map.getToolLayer().getCell(col, row);

if (tool > 0) {
this.pickupTool(tool);
this.game.map.getToolLayer().setCell(col, row, 0);
}

if (this.game.map.hasFeature(row, col, Global.DEADLY)) {
this.isAlive = false;
return;
}

if (this.status == Global.BORN
&& this.characterClock > Global.BORN_TIME) {
this.status = Global.SOUTH;
this.setFrame(Global.SOUTH * 6);
this.isCanOperate = true;
}

if (this.status == Global.BORN) {
if (this.characterClock % 2 == 0)
this.setFrame(Global.BORN * 6 + (this.getFrame() - 1) % 4);
return;
}

} else {
this.isCanOperate = false;
if (this.deadTime <= 20) {
this.deadTime++;
} else {
this.deadTime = 100;
this.setVisible(false);
return;
}

if (this.characterClock % 2 == 0) {
if (this.getFrame() < Global.DEAD * 6) {
this.setFrame(Global.DEAD * 6);
} else {
if (this.getFrame() < 29) {
this.setFrame(this.getFrame() + 1);
} else {
if (this.characterClock % 4 == 0) {
this.setFrame(29);
this.setVisible(true);
} else {
this.setVisible(false);
}
}
}
}
}
}

public void walk(int direction) {
if (!isAlive)
return;
if (!isCanOperate)
return;
if(direction==9) return;
this.collisionCheck(direction);

if (this.characterClock % 2 == 0) {
if (this.status == direction) {
this.setFrame(this.status * 6 + (this.getFrame() + 1) % 6);
} else {
this.status = direction;
this.setFrame(this.status * 6);
}
}
this.setPosition(xCoodinate, yCoodinate);
}

public void stop() {
this.isCanOperate = false;
}

public void play() {
this.isCanOperate = true;
}

public abstract void setBomb(int row, int col);

public void increaseBomb() {
if (this.bombNums < Global.MAX_BOMB_NUMBER)
this.bombNums++;
}

public int getRow() {
return getRow(getBottomY(yCoodinate) - Global.MAP_CELL / 2);
}

public int getCol() {
return getCol(xCoodinate + Global.MAP_CELL / 2);
}

protected int getBottomY(int y) {
return y + this.height - 1;
}

protected int getRightX(int x) {
return x + Global.MAP_CELL - 1;
}

protected int getPreY(int y) {
return getBottomY(y) + 1 - Global.MAP_CELL;
}

protected int getRow(int x) {
return x / Global.MAP_CELL;
}

protected int getCol(int y) {
return y / Global.MAP_CELL;
}
}

我的QQ是609419340

看不明白的可以隨時來問我哦,還可以當時傳給你撒

J. 安卓手機游戲中的代碼如何獲得

您好
獲取游戲源代碼需要對APK進行反編譯,如果APK已經加密,無法通過反編譯的方法獲取源代碼
目前反編譯的軟體有很多,您可以在騰訊電腦管家中下載,推薦使用【改之理】,一款非常好用的反編譯軟體,傻瓜式操作,適合新手,您網路也能搜索到

希望可以幫到您,望採納
騰訊電腦管家企業平台:http://..com/c/guanjia/

閱讀全文

與安卓回合游戲源碼相關的資料

熱點內容
非科班程序員自學 瀏覽:799
壓縮泡沫鞋底底材 瀏覽:217
程序員職場第一課2正確的溝通 瀏覽:677
遇到不合法app應該怎麼辦 瀏覽:90
匯編程序編譯後的文件 瀏覽:77
大智慧均線源碼 瀏覽:371
單片機排阻的作用 瀏覽:213
滴滴金融app被下架如何還款 瀏覽:210
jpg轉換成pdf免費軟體 瀏覽:741
范里安pdf 瀏覽:443
偽造pdf 瀏覽:75
能刪除android文件夾嗎 瀏覽:446
LINUX使用V2ray 瀏覽:797
找人幫忙注冊app推廣是什麼 瀏覽:820
獨立伺服器如何恢復初始化 瀏覽:11
優秀到不能被忽視pdf 瀏覽:316
導遊程序員家政 瀏覽:586
22乘28的快速演算法 瀏覽:338
軟通動力程序員節2021 瀏覽:847
安卓系統如何卸載安裝包 瀏覽:870