當前位置:首頁 » 游戲種類 » 安卓農場游戲源碼

安卓農場游戲源碼

發布時間: 2022-09-30 18:57:57

① 求農場游戲c++代碼!!

1000元錢也許會有人傳給你……

② qq農場的源代碼是哪個國家編寫的

好像是中國台灣的。大陸都能叫「神七」上天,何況這類游戲,也只是個游戲而已。

③ 為什麼網上想找個cocos2d安卓版的游戲源碼例子那麼難

http://download.csdn.net/ 很多源碼 資源 很給力的網站

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

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,一個類文件,別把它當成一個文件了

⑤ 以前諾基亞手機上有款農場游戲,不僅可以種菜賣菜還可以打僵屍打地鼠,有人知道叫什麼嗎

這個游戲我是玩過的,不過現在應該都是一些安卓版的了,這個游戲的名字就是叫做僵屍打地鼠,如果下載的話,在應用寶中是有的,並且一些下載不到的游戲,在應用寶中搜索的話,還是很容易下載到手機中玩的呢

⑥ 尋找一款很舊的農場經營小游戲

《農夫時代》是一款以農場為背景模擬經營的游戲,也是一款能賺錢的游戲。

⑦ 有一種gameboy農場游戲,可以種菜,種蘑菇,養牛,釣魚,還可以給農場主的房子升級的游戲叫什麼、

叫牧場物語 也可叫農場物語 有1、2、3、特別版

⑧ 一款游戲換手機後忘了名字了,類似於農場的闖關的游戲,在規定時間內完成任務即可闖關成功,還可以雇員工

一款游戲換手機後忘了名字了,類似於農場的闖關的游戲,在規定時間內完成任務即可闖關成功,還可以雇員工一款游戲換手機後忘了名字了,類似於農場的闖關的游戲,在規定時間內完成任務即可闖關成功,還可以雇員工

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

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

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

這里將向彩民朋友介紹1些競彩足球游戲的簡單投注技能。 1、首先比較兩隊的本 5、注意分別哪些是「豪情球隊」和「危機球隊」。奪冠熱門球隊、衛冕

熱點內容
絕地求生未來之役比賽為什麼進不去 發布:2023-08-31 22:07:08 瀏覽:1397
dota2位置什麼意思 發布:2023-08-31 22:00:04 瀏覽:837
lol電競是什麼樣子 發布:2023-08-31 21:58:40 瀏覽:1296
絕地求生八倍鏡的那個圓圈怎麼弄 發布:2023-08-31 21:58:31 瀏覽:1382
lol龍龜一個多少金幣 發布:2023-08-31 21:55:07 瀏覽:745
王者如何改游戲內名稱 發布:2023-08-31 21:55:06 瀏覽:1036
游戲主播打廣告是什麼意思 發布:2023-08-31 21:55:06 瀏覽:1718
絕地求生如何免費拿到ss7賽季手冊 發布:2023-08-31 21:52:13 瀏覽:915
pgg是哪個國家的戰隊lol 發布:2023-08-31 21:52:07 瀏覽:794
一個人的時候才發現游戲很沒意思 發布:2023-08-31 21:49:24 瀏覽:1429