智能终端软件开发课程设计报告Word下载.docx

上传人:b****1 文档编号:15349953 上传时间:2022-10-29 格式:DOCX 页数:22 大小:490.81KB
下载 相关 举报
智能终端软件开发课程设计报告Word下载.docx_第1页
第1页 / 共22页
智能终端软件开发课程设计报告Word下载.docx_第2页
第2页 / 共22页
智能终端软件开发课程设计报告Word下载.docx_第3页
第3页 / 共22页
智能终端软件开发课程设计报告Word下载.docx_第4页
第4页 / 共22页
智能终端软件开发课程设计报告Word下载.docx_第5页
第5页 / 共22页
点击查看更多>>
下载资源
资源描述

智能终端软件开发课程设计报告Word下载.docx

《智能终端软件开发课程设计报告Word下载.docx》由会员分享,可在线阅读,更多相关《智能终端软件开发课程设计报告Word下载.docx(22页珍藏版)》请在冰豆网上搜索。

智能终端软件开发课程设计报告Word下载.docx

本次课程设计主要内容是双人五子棋游戏的开发。

主要内容是界面布局、判断输赢,记录输赢次数。

开发想法来源,纯属娱乐。

关键词:

益智游戏Android

第一部分分析游戏

一、游戏功能简述

1、界面布局

按照象棋的表格图案绘制布局,在画布上设计表格,并标记红黑方位置。

2、棋子连线分析

标明五子棋的颜色,记录分析棋子的位置,判断是否取胜。

3、记录输赢次数

记录红黑双方输赢次数。

二、游戏核心技术

1、基本技术组成

判断路径,数据结构算法。

2、关键技术难点分析

1、技术难点

分析棋子连线是否可以取胜。

2、作为难点的原因

棋子之间有三种连线情况,横向连续连接、纵向连续连接、对角线连续连接。

3、准备突破方法

将同类棋子之间,有位置关系的棋子进行进栈处理,如果在棋盘范围内,有连续的五个棋子则为取胜。

第二部分设计与开发

一、前期准备工作

软件环境:

Windows

AndroidSDK;

Eclipse(windows版)

环境配置:

Windows下AndroidSDK安装。

安装步骤:

1、下载SDK包,Android-SDK,下载地址:

2、配置SDK

导入sdk文件

二、游戏预期效果

1、UI设计

背景画布选择恰当,布局清晰,结构清晰,使用简单。

2、棋盘设计

方格大小,连线之间的距离适中,确保棋子在连线上,避免棋子在棋盘上混乱摆放。

3、提示框

出现下棋位置不在棋盘内或者不在合法范围内是出现错误提示

当由一方取得胜利时,出现提示框。

三、开发过程

1、布局设计

packagecn.m.xys;

//Downloadby

importandroid.app.Activity;

importandroid.os.Bundle;

importandroid.view.Display;

importandroid.view.KeyEvent;

importandroid.view.Window;

importandroid.view.WindowManager;

publicclassFiveChessActivityextendsActivity

{

GameViewgameView=null;

@Override

publicvoidonCreate(BundlesavedInstanceState)

{

super.onCreate(savedInstanceState);

//隐藏标题栏

requestWindowFeature(Window.FEATURE_NO_TITLE);

//全屏显示

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,

WindowManager.LayoutParams.FLAG_FULLSCREEN);

//获取屏幕宽高

Displaydisplay=getWindowManager().getDefaultDisplay();

//现实GameView

GameView.init(this,display.getWidth(),display.getHeight());

gameView=GameView.getInstance();

setContentView(gameView);

}

publicbooleanonKeyDown(intkeyCode,KeyEventevent)

returnsuper.onKeyDown(keyCode,event);

}

}

2、算法设计

importandroid.content.Context;

importandroid.content.res.Resources;

importandroid.graphics.Bitmap;

importandroid.graphics.BitmapFactory;

importandroid.graphics.Canvas;

importandroid.graphics.Color;

importandroid.graphics.Matrix;

importandroid.graphics.Paint;

importandroid.graphics.Rect;

importandroid.view.MotionEvent;

importandroid.view.SurfaceHolder;

importandroid.view.SurfaceView;

/**

*@authorAdministrator

*

*/

publicclassGameViewextendsSurfaceViewimplementsConst,SurfaceHolder.Callback,Runnable

staticGameViewsInstance=null;

publicstaticvoidinit(ActivitymActivity,intscreenWidth,intscreenHeight)

sInstance=newGameView(mActivity,screenWidth,screenHeight);

publicstaticGameViewgetInstance()

returnsInstance;

//控制循环

booleanmbLoop=false;

//定义SurfaceHolder对象

SurfaceHoldermSurfaceHolder=null;

publicstaticPaintsPaint=null;

publicstaticCanvassCanvas=null;

publicstaticResourcessResources=null;

privateintmGameState=0;

privateintmScreenWidth=0;

privateintmScreenHeight=0;

publicint[][]mGameMap=null;

privateintmMapHeightLengh=0;

privateintmMapWidthLengh=0;

privateintmMapIndexX=0;

privateintmMapIndexY=0;

publicintmCampTurn=0;

publicintmCampWinner=0;

privatefloatmTitleSpace=0;

privateintmTitleHeight=0;

privatefloatmTitleIndex_x=0;

privatefloatmTitleIndex_y=0;

BitmapbitmapBg=null;

BitmapmBlack=null;

BitmapmWhite=null;

ContextmContext=null;

publicGameView(Activityactivity,intscreenWidth,intscreenHeight)

super(activity);

sPaint=newPaint();

sPaint.setAntiAlias(true);

sResources=getResources();

mContext=activity;

mScreenWidth=screenWidth;

mScreenHeight=screenHeight;

mSurfaceHolder=this.getHolder();

mSurfaceHolder.addCallback(this);

setFocusable(true);

mbLoop=true;

bitmapBg=CreatMatrixBitmap(R.drawable.status,mScreenWidth,mScreenHeight);

mBlack=BitmapFactory.decodeResource(GameView.sResources,R.drawable.ai);

mWhite=BitmapFactory.decodeResource(GameView.sResources,R.drawable.human);

mTitleSpace=(float)mScreenWidth/CHESS_WIDTH;

mTitleHeight=mScreenHeight/3;

mTitleIndex_x=(float)(mTitleSpace/2);

mTitleIndex_y=(float)(mTitleSpace/2);

setGameState(GS_GAME);

publicvoidsetGameState(intnewState)

mGameState=newState;

switch(mGameState)

{

caseGS_GAME:

mGameMap=newint[CHESS_HEIGHT][CHESS_WIDTH];

mMapHeightLengh=mGameMap.length;

mMapWidthLengh=mGameMap[0].length;

mCampTurn=CAMP_HERO;

break;

}

protectedvoidDraw()

sCanvas=mSurfaceHolder.lockCanvas();

if(mSurfaceHolder==null||sCanvas==null)

return;

RenderGame();

mSurfaceHolder.unlockCanvasAndPost(sCanvas);

privatevoidRenderGame()

DrawRect(Color.WHITE,0,0,mScreenWi

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 党团工作 > 入党转正申请

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1