当前位置:首页 » 游戏种类 » 安卓农场游戏源码

安卓农场游戏源码

发布时间: 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