「java游戏设计报告」游戏开发与设计报告
今天给各位分享java游戏设计报告的知识,其中也会对游戏开发与设计报告进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!
本文目录一览:
- 1、!高分跪求帮忙写一个简单小程序的JAVA课程设计报告(内详!!)
- 2、有关java开发游戏毕业设计的开题报告
- 3、求Java课程设计—小游戏(含源代码)
- 4、java面向对象程序设计实验报告怎么写
- 5、求java大神帮忙写下java程序设计的实验报告中的程序 一些语句 谢了
- 6、200求JAVA课程设计报告 关于手机华容道的
!高分跪求帮忙写一个简单小程序的JAVA课程设计报告(内详!!)
连连看java源代码
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class lianliankan implements ActionListener
{
JFrame mainFrame; //主面板
Container thisContainer;
JPanel centerPanel,southPanel,northPanel; //子面板
JButton diamondsButton[][] = new JButton[6][5];//游戏按钮数组
JButton exitButton,resetButton,newlyButton; //退出,重列,重新开始按钮
JLabel fractionLable=new JLabel("0"); //分数标签
JButton firstButton,secondButton; //分别记录两次被选中的按钮
int grid[][] = new int[8][7];//储存游戏按钮位置
static boolean pressInformation=false; //判断是否有按钮被选中
int x0=0,y0=0,x=0,y=0,fristMsg=0,secondMsg=0,validateLV; //游戏按钮的位置坐标
int i,j,k,n;//消除方法控制
public void init(){
mainFrame=new JFrame("JKJ连连看");
thisContainer = mainFrame.getContentPane();
thisContainer.setLayout(new BorderLayout());
centerPanel=new JPanel();
southPanel=new JPanel();
northPanel=new JPanel();
thisContainer.add(centerPanel,"Center");
thisContainer.add(southPanel,"South");
thisContainer.add(northPanel,"North");
centerPanel.setLayout(new GridLayout(6,5));
for(int cols = 0;cols 6;cols++){
for(int rows = 0;rows 5;rows++ ){
diamondsButton[cols][rows]=new JButton(String.valueOf(grid[cols+1][rows+1]));
diamondsButton[cols][rows].addActionListener(this);
centerPanel.add(diamondsButton[cols][rows]);
}
}
exitButton=new JButton("退出");
exitButton.addActionListener(this);
resetButton=new JButton("重列");
resetButton.addActionListener(this);
newlyButton=new JButton("再来一局");
newlyButton.addActionListener(this);
southPanel.add(exitButton);
southPanel.add(resetButton);
southPanel.add(newlyButton);
fractionLable.setText(String.valueOf(Integer.parseInt(fractionLable.getText())));
northPanel.add(fractionLable);
mainFrame.setBounds(280,100,500,450);
mainFrame.setVisible(true);
}
public void randomBuild() {
int randoms,cols,rows;
for(int twins=1;twins=15;twins++) {
randoms=(int)(Math.random()*25+1);
for(int alike=1;alike=2;alike++) {
cols=(int)(Math.random()*6+1);
rows=(int)(Math.random()*5+1);
while(grid[cols][rows]!=0) {
cols=(int)(Math.random()*6+1);
rows=(int)(Math.random()*5+1);
}
this.grid[cols][rows]=randoms;
}
}
}
public void fraction(){
fractionLable.setText(String.valueOf(Integer.parseInt(fractionLable.getText())+100));
}
public void reload() {
int save[] = new int[30];
int n=0,cols,rows;
int grid[][]= new int[8][7];
for(int i=0;i=6;i++) {
for(int j=0;j=5;j++) {
if(this.grid[i][j]!=0) {
save[n]=this.grid[i][j];
n++;
}
}
}
n=n-1;
this.grid=grid;
while(n=0) {
cols=(int)(Math.random()*6+1);
rows=(int)(Math.random()*5+1);
while(grid[cols][rows]!=0) {
cols=(int)(Math.random()*6+1);
rows=(int)(Math.random()*5+1);
}
this.grid[cols][rows]=save[n];
n--;
}
mainFrame.setVisible(false);
pressInformation=false; //这里一定要将按钮点击信息归为初始
init();
for(int i = 0;i 6;i++){
for(int j = 0;j 5;j++ ){
if(grid[i+1][j+1]==0)
diamondsButton[i][j].setVisible(false);
}
}
}
public void estimateEven(int placeX,int placeY,JButton bz) {
if(pressInformation==false) {
x=placeX;
y=placeY;
secondMsg=grid[x][y];
secondButton=bz;
pressInformation=true;
}
else {
x0=x;
y0=y;
fristMsg=secondMsg;
firstButton=secondButton;
x=placeX;
y=placeY;
secondMsg=grid[x][y];
secondButton=bz;
if(fristMsg==secondMsg secondButton!=firstButton){
xiao();
}
}
}
public void xiao() { //相同的情况下能不能消去。仔细分析,不一条条注释
if((x0==x (y0==y+1||y0==y-1)) || ((x0==x+1||x0==x-1)(y0==y))){ //判断是否相邻
remove();
}
else{
for (j=0;j7;j++ ) {
if (grid[x0][j]==0){ //判断第一个按钮同行哪个按钮为空
if (yj) { //如果第二个按钮的Y坐标大于空按钮的Y坐标说明第一按钮在第二按钮左边
for (i=y-1;i=j;i-- ){ //判断第二按钮左侧直到第一按钮中间有没有按钮
if (grid[x][i]!=0) {
k=0;
break;
}
else{ k=1; } //K=1说明通过了第一次验证
}
if (k==1) {
linePassOne();
}
}
if (yj){ //如果第二个按钮的Y坐标小于空按钮的Y坐标说明第一按钮在第二按钮右边
for (i=y+1;i=j ;i++ ){ //判断第二按钮左侧直到第一按钮中间有没有按钮
if (grid[x][i]!=0){
k=0;
break;
}
else { k=1; }
}
if (k==1){
linePassOne();
}
}
if (y==j ) {
linePassOne();
}
}
if (k==2) {
if (x0==x) {
remove();
}
if (x0x) {
for (n=x0;n=x-1;n++ ) {
if (grid[n][j]!=0) {
k=0;
break;
}
if(grid[n][j]==0 n==x-1) {
remove();
}
}
}
if (x0x) {
for (n=x0;n=x+1 ;n-- ) {
if (grid[n][j]!=0) {
k=0;
break;
}
if(grid[n][j]==0 n==x+1) {
remove();
}
}
}
}
}
for (i=0;i8;i++ ) { //列
if (grid[i][y0]==0) {
if (xi) {
for (j=x-1;j=i ;j-- ) {
if (grid[j][y]!=0) {
k=0;
break;
}
else { k=1; }
}
if (k==1) {
rowPassOne();
}
}
if (xi) {
for (j=x+1;j=i;j++ ) {
if (grid[j][y]!=0) {
k=0;
break;
}
else { k=1; }
}
if (k==1) {
rowPassOne();
}
}
if (x==i) {
rowPassOne();
}
}
if (k==2){
if (y0==y) {
remove();
}
if (y0y) {
for (n=y0;n=y-1 ;n++ ) {
if (grid[i][n]!=0) {
k=0;
break;
}
if(grid[i][n]==0 n==y-1) {
remove();
}
}
}
if (y0y) {
for (n=y0;n=y+1 ;n--) {
if (grid[i][n]!=0) {
k=0;
break;
}
if(grid[i][n]==0 n==y+1) {
remove();
}
}
}
}
}
}
}
public void linePassOne(){
if (y0j){ //第一按钮同行空按钮在左边
for (i=y0-1;i=j ;i-- ){ //判断第一按钮同左侧空按钮之间有没按钮
if (grid[x0][i]!=0) {
k=0;
break;
}
else { k=2; } //K=2说明通过了第二次验证
}
}
if (y0j){ //第一按钮同行空按钮在与第二按钮之间
for (i=y0+1;i=j ;i++){
if (grid[x0][i]!=0) {
k=0;
break;
}
else{ k=2; }
}
}
}
public void rowPassOne(){
if (x0i) {
for (j=x0-1;j=i ;j-- ) {
if (grid[j][y0]!=0) {
k=0;
break;
}
else { k=2; }
}
}
if (x0i) {
for (j=x0+1;j=i ;j++ ) {
if (grid[j][y0]!=0) {
k=0;
break;
}
else { k=2; }
}
}
}
public void remove(){
firstButton.setVisible(false);
secondButton.setVisible(false);
fraction();
pressInformation=false;
k=0;
grid[x0][y0]=0;
grid[x][y]=0;
}
public void actionPerformed(ActionEvent e) {
if(e.getSource()==newlyButton){
int grid[][] = new int[8][7];
this.grid = grid;
randomBuild();
mainFrame.setVisible(false);
pressInformation=false;
init();
}
if(e.getSource()==exitButton)
System.exit(0);
if(e.getSource()==resetButton)
reload();
for(int cols = 0;cols 6;cols++){
for(int rows = 0;rows 5;rows++ ){
if(e.getSource()==diamondsButton[cols][rows])
estimateEven(cols+1,rows+1,diamondsButton[cols][rows]);
}
}
}
public static void main(String[] args) {
lianliankan llk = new lianliankan();
llk.randomBuild();
llk.init();
}
}
//old 998 lines
//new 318 lines
参考资料:
有关java开发游戏毕业设计的开题报告
首先介绍了手机游戏开发的背景、目的、意义和手机游戏开发的国内外现状等,接着介绍了手机游戏的特征、类型,以及手机游戏开发的基本原则等。
此外,还详细介绍了手机游戏的开发语言Java和开发平台J2ME,讲述了如何搭建J2ME平台,为读者了解手机游戏开发和设计打下了一定的基础,同时也讲述了有关Eclipse和MIDP应用程序的一些知识。
接着在本文中介绍了手机游戏程序的结构、思想以及相关技术,主要是介绍了几个主要的类:Canvas类和Graphics类,还有介绍了程序中的绘图技术、混淆器的使用、模拟器的调试等。
最后本文介绍了手机游戏程序的代码编写和程序结构等,让读者对本文的手机游戏程序有了一个概括性的了解。
关键词:J2ME,Java,Ecilpse,手机游戏,MIDP ABSTRACT
This article introduces something about mobile telephone game.For example, the background and the objective and the meaning of it,and the developing status in in-country and out-country.And then introduces the character and the style of telephone game and the basic principle of telephone game exploitation.
And then this article introduces Java language and J2ME flat of telephone game exploitation, also narrate how to build J2ME flat. That would be propitious to reader to make a design.And this article also introduces something about Eclipse and MIDP application in addition.
In succession,this article introduces the configuration and idea and correlation technique of telephone games development.Mainly comes down to Canvas and Graphics,and plot technic in games,and how to use Obfuscator and how to debug simulator.
Finally,this article explains the code of telephone games and the program structure,readers will be understands the phone games in this article.
Keyword:J2ME,Java,Eclipse,telephone game,MIDP
目 录
1.绪 言 5
1.1 手机游戏研究的背景 5
1.2 手机游戏研究的目的和意义 5
1.3 手机游戏的国内外现状 6
1.4 手机游戏概述 7
1.4.1 手机游戏特征 7
1.4.2 手机游戏的类型 8
1.4.3 手机游戏设计的基本原则 8
2.开发环境及相关技术的介绍 10
2.1 JAVA语言特点 10
2.2 J2ME概述 10
2.3 J2ME体系结构 11
2.4 关于ECLIPSE 13
2.5 J2ME开发环境的搭建 13
2.6 MIDP应用程序 14
2.7 JAVA APPLICATION MANAGER 14
3.程序结构、思想和相关技术 15
3.1 本程序需解决的有关技术问题 15
3.2 程序流程图 15
3.3 绘图与MIDP2.0新增的GAMECANVAS包 16
3.3.1 Canvas类 17
3.3.2 Graphics类 17
3.3.3 PNG格式 17
3.3.4 有关绘图的一些技术 18
3.4 内存使用最佳化 18
3.5 混淆器(OBFUSCATOR)的使用 19
3.6 模拟器的调试 19
4.程序分析和编写手机代码 20
4.1 进入游戏前的选择 20
4.2 主游戏逻辑及其涉及到的若干类 20
4.2.1 程序的菜单选项 20
4.2.2 游戏的设定 21
4.2.3 游戏的界面绘制 24
4.2.4 游戏中板的出现和小人位置的检测 25
6.总结与展望 26
7.致 谢 27
参考文献 28
求Java课程设计—小游戏(含源代码)
Tank——坦克大战(简洁版)源代码-------(此文档是自己在韩顺平教程总结而来)
* 功能: 1.防止敌人的坦克重叠运动
* (决定把判断是否碰撞的函数写到EnemyTank类)
* 2.可以分关
* 2.1 (做一个开始的Panel,它是一个空的)
* 2.2 开始字体闪烁
* 3.可以在玩游戏的时候,暂停和继续
* 3.1当用户点击暂停时,子弹的速度和坦克速度设为0,并让坦克的方向
* 不要发生变化。
* 4.可以记录玩家的成绩
* 4.1用文件流的方式(小游戏)[大游戏是用的数据库cs,bs结构,三国]
* 4.2单写一个记录类,完成对玩家的记录
* 4.3先完成保存共击毁了多少辆敌人坦克的功能
* 4.4存盘退出游戏,可以记录当时的敌人的坦克坐标,并可以恢复
* 5.java如何操作声音文件
*/
java面向对象程序设计实验报告怎么写
1。People.java
public class People {
//性别(sex)及出生日期(date);方法成员有:获取人的性别和出生日期及构造方法。要求构造方法可以设置性别和出生日期的初始值。
private int sex;
private Date birth;
public People (int sex, Date birth) {
this.sex = sex;
this.birth = birth;
}
public int getSex() {
return this.sex;
}
public Date getBirth() {
return this.birth;
}
}
2。Student.java
public class Student extends People{
private int sex;
private Date birth;
private String name;
private int stuno;
private double grate;
private String studentNative;
public Student(int sex, Date birth, String name, int stuno, double grate, String studentNative) {
super(sex, birth);
this.name = name;
this.stuno = stuno;
this.grate = grate;
this.studentNative = studentNative;
}
public Date getBirth() {
return birth;
}
public double getGrate() {
return grate;
}
public String getName() {
return name;
}
public int getSex() {
return sex;
}
public String getStudentNative() {
return studentNative;
}
public int getStuno() {
return stuno;
}
}
3。测试类自己编写就好了,创建一个People和Student的对象,然后设置值,取值就可以了。
五。
1.构造方法没有返回值,方法名和类名一样.
2.继承是指子类可以拥有父类的方法和属性;多态是指父类的引用可以指向子类对象的实例
3.重写
4.重载
求java大神帮忙写下java程序设计的实验报告中的程序 一些语句 谢了
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class TestString {
public static void main(String arg[]) throws IOException {
int a,n;
System.out.println("请输入a,n:");
BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));
String readStr=buf.readLine();
String argStr[]=readStr.split(",");
a=Integer.parseInt(argStr[0]);
n=Integer.parseInt(argStr[1]);
long sum=0,aaa=0;
for (int i=1;i=n;i++){
aaa=(long)getaaa(a,i);
sum+=aaa;
System.out.print(aaa);
if (i==n) System.out.print("=");
else System.out.print("+");
}
System.out.println(""+sum);
}
static double getaaa(int a,int n){
double aaa=a;
for(double i=1;in;i++){
aaa+=a*Math.pow(10, i);
}
return aaa;
}
}
需要注意的是这里面引入了几个java包。
第2个:;__bd_tkn__=6ef56e5d3a2499274a6df875f5b773e682519fb8a07960d151bbad4928e085c42f309a67e9e08f6c24eb7e11a1fbf820dff421b52a
200求JAVA课程设计报告 关于手机华容道的
这个我试了的没有任务问题,稀望对你有点帮助,记得类名要改为Hua_Rong_Road ,因为只有Hua_Rong_Road 这个类是公开的.另外包名也改下package xxxx(你自己建的包名),玩游戏时移动人物,用键盘(上下左右 ,--,--,上,下)操作,鼠标是不能移动 人物的,照着我说的做,应该是没什么问题的:
package baidu.testfive;
import java.applet.Applet;
import java.awt.Button;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
class People extends Button implements FocusListener // 代表华容道人物的类。
{
Rectangle rect = null;
int left_x, left_y;// 按扭的左上角坐标.
int width, height; // 按扭的宽和高.
String name;
int number;
People(int number, String s, int x, int y, int w, int h, Hua_Rong_Road road)// 构造函数
{
super(s);
name = s;
this.number = number;
left_x = x;
left_y = y;
width = w;
height = h;
setBackground(Color.orange);
road.add(this);
addKeyListener(road);
setBounds(x, y, w, h);
addFocusListener(this);
rect = new Rectangle(x, y, w, h);
}
public void focusGained(FocusEvent e) {
setBackground(Color.red);
}
public void focusLost(FocusEvent e) {
setBackground(Color.orange);
}
}
public class Hua_Rong_Road extends Applet implements KeyListener,
ActionListener {
People people[] = new People[10];
Rectangle left, right, above, below;// 华容道的边界 .
Button restart = new Button("重新开始");
public void init() {
setLayout(null);
add(restart);
restart.setBounds(5, 5, 80, 25);
restart.addActionListener(this);
people[0] = new People(0, "曹操", 104, 54, 100, 100, this);// 构造曹操
people[1] = new People(1, "关羽", 104, 154, 100, 50, this);// 构造关羽
people[2] = new People(2, "张飞", 54, 154, 50, 100, this);
people[3] = new People(3, "刘备", 204, 154, 50, 100, this);
people[4] = new People(4, "张辽", 54, 54, 50, 100, this);
people[5] = new People(5, "曹仁", 204, 54, 50, 100, this);
people[6] = new People(6, "兵 ", 54, 254, 50, 50, this);
people[7] = new People(7, "兵 ", 204, 254, 50, 50, this);
people[8] = new People(8, "兵 ", 104, 204, 50, 50, this);
people[9] = new People(9, "兵 ", 154, 204, 50, 50, this);
people[9].requestFocus();
left = new Rectangle(49, 49, 5, 260);
people[0].setForeground(Color.white);
right = new Rectangle(254, 49, 5, 260);
above = new Rectangle(49, 49, 210, 5);
below = new Rectangle(49, 304, 210, 5);
}
public void paint(Graphics g) {// 画出华容道的边界:
g.setColor(Color.cyan);
g.fillRect(49, 49, 5, 260);// left.
g.fillRect(254, 49, 5, 260);// right.
g.fillRect(49, 49, 210, 5); // above.
g.fillRect(49, 304, 210, 5);// below.
// 提示曹操逃出位置和按键规则:
g.drawString("点击相应的人物,然后按键盘上的上下左右箭头移动", 100, 20);
g.setColor(Color.red);
g.drawString("曹操到达该位置", 110, 300);
}
public void keyPressed(KeyEvent e) {
People man = (People) e.getSource();// 获取事件源.
man.rect.setLocation(man.getBounds().x, man.getBounds().y);
if (e.getKeyCode() == KeyEvent.VK_DOWN) {
man.left_y = man.left_y + 50; // 向下前进50个单位。
man.setLocation(man.left_x, man.left_y);
man.rect.setLocation(man.left_x, man.left_y);
// 判断是否和其它人物或下边界出现重叠,如果出现重叠就退回50个单位距离。
for (int i = 0; i 10; i++) {
if ((man.rect.intersects(people[i].rect)) (man.number != i)) {
man.left_y = man.left_y - 50;
man.setLocation(man.left_x, man.left_y);
man.rect.setLocation(man.left_x, man.left_y);
}
}
if (man.rect.intersects(below)) {
man.left_y = man.left_y - 50;
man.setLocation(man.left_x, man.left_y);
man.rect.setLocation(man.left_x, man.left_y);
}
}
if (e.getKeyCode() == KeyEvent.VK_UP) {
man.left_y = man.left_y - 50; // 向上前进50个单位。
man.setLocation(man.left_x, man.left_y);
man.rect.setLocation(man.left_x, man.left_y);
// 判断是否和其它人物或上边界出现重叠,如果出现重叠就退回50个单位距离。
for (int i = 0; i 10; i++) {
if ((man.rect.intersects(people[i].rect)) (man.number != i)) {
man.left_y = man.left_y + 50;
man.setLocation(man.left_x, man.left_y);
man.rect.setLocation(man.left_x, man.left_y);
}
}
if (man.rect.intersects(above)) {
man.left_y = man.left_y + 50;
man.setLocation(man.left_x, man.left_y);
man.rect.setLocation(man.left_x, man.left_y);
}
}
if (e.getKeyCode() == KeyEvent.VK_LEFT) {
man.left_x = man.left_x - 50; // 向左前进50个单位。
man.setLocation(man.left_x, man.left_y);
man.rect.setLocation(man.left_x, man.left_y);
// 判断是否和其它人物或左边界出现重叠,如果出现重叠就退回50个单位距离。
for (int i = 0; i 10; i++) {
if ((man.rect.intersects(people[i].rect)) (man.number != i)) {
man.left_x = man.left_x + 50;
man.setLocation(man.left_x, man.left_y);
man.rect.setLocation(man.left_x, man.left_y);
}
}
if (man.rect.intersects(left)) {
man.left_x = man.left_x + 50;
man.setLocation(man.left_x, man.left_y);
man.rect.setLocation(man.left_x, man.left_y);
}
}
if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
man.left_x = man.left_x + 50; // 向右前进50个单位。
man.setLocation(man.left_x, man.left_y);
man.rect.setLocation(man.left_x, man.left_y);
// 判断是否和其它人物或右边界出现重叠,如果出现重叠就退回50个单位距离。
for (int i = 0; i 10; i++) {
if ((man.rect.intersects(people[i].rect)) (man.number != i)) {
man.left_x = man.left_x - 50;
man.setLocation(man.left_x, man.left_y);
man.rect.setLocation(man.left_x, man.left_y);
}
}
if (man.rect.intersects(right)) {
man.left_x = man.left_x - 50;
man.setLocation(man.left_x, man.left_y);
man.rect.setLocation(man.left_x, man.left_y);
}
}
}
public void keyTyped(KeyEvent e) {
}
public void keyReleased(KeyEvent e) {
}
public void actionPerformed(ActionEvent e) {
this.removeAll();
this.init();
}
}
关于java游戏设计报告和游戏开发与设计报告的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。