俄罗斯方块课程设计报告文档格式.doc

上传人:聆听****声音 文档编号:809631 上传时间:2023-04-29 格式:DOC 页数:25 大小:161KB
下载 相关 举报
俄罗斯方块课程设计报告文档格式.doc_第1页
第1页 / 共25页
俄罗斯方块课程设计报告文档格式.doc_第2页
第2页 / 共25页
俄罗斯方块课程设计报告文档格式.doc_第3页
第3页 / 共25页
俄罗斯方块课程设计报告文档格式.doc_第4页
第4页 / 共25页
俄罗斯方块课程设计报告文档格式.doc_第5页
第5页 / 共25页
俄罗斯方块课程设计报告文档格式.doc_第6页
第6页 / 共25页
俄罗斯方块课程设计报告文档格式.doc_第7页
第7页 / 共25页
俄罗斯方块课程设计报告文档格式.doc_第8页
第8页 / 共25页
俄罗斯方块课程设计报告文档格式.doc_第9页
第9页 / 共25页
俄罗斯方块课程设计报告文档格式.doc_第10页
第10页 / 共25页
俄罗斯方块课程设计报告文档格式.doc_第11页
第11页 / 共25页
俄罗斯方块课程设计报告文档格式.doc_第12页
第12页 / 共25页
俄罗斯方块课程设计报告文档格式.doc_第13页
第13页 / 共25页
俄罗斯方块课程设计报告文档格式.doc_第14页
第14页 / 共25页
俄罗斯方块课程设计报告文档格式.doc_第15页
第15页 / 共25页
俄罗斯方块课程设计报告文档格式.doc_第16页
第16页 / 共25页
俄罗斯方块课程设计报告文档格式.doc_第17页
第17页 / 共25页
俄罗斯方块课程设计报告文档格式.doc_第18页
第18页 / 共25页
俄罗斯方块课程设计报告文档格式.doc_第19页
第19页 / 共25页
俄罗斯方块课程设计报告文档格式.doc_第20页
第20页 / 共25页
亲,该文档总共25页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

俄罗斯方块课程设计报告文档格式.doc

《俄罗斯方块课程设计报告文档格式.doc》由会员分享,可在线阅读,更多相关《俄罗斯方块课程设计报告文档格式.doc(25页珍藏版)》请在冰点文库上搜索。

俄罗斯方块课程设计报告文档格式.doc

(3)级别设置:

玩家可以根据自己的需要自行设定游戏的开始级别,级别越高,游戏的速度越快,难度越大。

(4)系统功能模块示意图如下:

俄罗斯方块游戏

游戏区

游戏控制

显示玩家操作

显示操作结果

开始

暂停/继续

提高等级

退出

降低等级

二、设计说明

2.1游戏区模块

游戏区模块

创建游戏区

处理玩家游戏操作

显示游戏结果

2.2控制区模块

游戏控制模块

开始游戏

暂停游戏

初始级别设置

退出游戏

2.3系统流程图

是否到顶部

处理玩家操作

设置初始级别

游戏开局

随机选择方块类型

方块下落一行

游戏结束

2.4系统操作界面

游戏打开界面

游戏进行中界面

三、源程序编码

importjavax.swing.*;

importjava.awt.*;

importjavax.swing.border.Border;

importjava.awt.event.*;

publicclassErsBlocksGameextendsJFrame{

publicfinalstaticintalinescore=100;

publicfinalstaticinteverylevelscore=alinescore*20;

publicfinalstaticintmaxlevel=10;

publicfinalstaticintinitlevel=5;

privateGameCanvascanvas;

privateErsBlockblock;

privatebooleanplaying=false;

privateControlPanelctrlPanel;

privateJMenuBarbar=newJMenuBar();

privateJMenu

mGame=newJMenu("

游戏"

),

mControl=newJMenu("

控制"

mhelp=newJMenu("

帮助"

);

privateJMenuItem

miNewGame=newJMenuItem("

新游戏"

milevelup=newJMenuItem("

提高级数"

mileveldown=newJMenuItem("

降低级数"

miExit=newJMenuItem("

退出"

miPlay=newJMenuItem("

开始"

miPause=newJMenuItem("

暂停"

miResume=newJMenuItem("

重新开始"

miStop=newJMenuItem("

停止"

miCtrlBlock=newJMenuItem("

方块控制键"

publicErsBlocksGame(Stringtitle)

{

super(title);

setSize(315,392);

DimensionscrSize=Toolkit.getDefaultToolkit().getScreenSize();

setLocation((scrSize.width-getSize().width)/2,

(scrSize.height-getSize().height)/2);

createMenu();

Containercontainer=getContentPane();

container.setLayout(newBorderLayout(6,0));

canvas=newGameCanvas(20,12);

ctrlPanel=newControlPanel(this);

container.add(canvas,BorderLayout.CENTER);

container.add(ctrlPanel,BorderLayout.EAST);

addWindowListener(newWindowAdapter(){

publicvoidwindowClosing(WindowEventwe){

stopGame();

System.exit(0);

}

});

addComponentListener(newComponentAdapter(){

publicvoidcomponentResized(ComponentEventce){

canvas.fanning();

show();

canvas.fanning();

}

privatevoidcreateMenu()

bar.add(mGame);

bar.add(mControl);

bar.add(mhelp);

mGame.add(miNewGame);

mGame.addSeparator();

mGame.add(milevelup);

mGame.add(mileveldown);

mGame.add(miExit);

mControl.add(miPlay);

mControl.addSeparator();

mControl.add(miPause);

mControl.add(miResume);

mControl.add(miStop);

mhelp.add(miCtrlBlock);

setJMenuBar(bar);

miNewGame.addActionListener(newActionListener(){

publicvoidactionPerformed(ActionEventae)

{

reset();

setLevel(initlevel);

mileveldown.addActionListener(newActionListener(){

publicvoidactionPerformed(ActionEventae)

intcurLevel=getLevel();

if(curLevel>

1)

setLevel(curLevel-1);

milevelup.addActionListener(newActionListener(){

setLevel(curLevel+1);

miExit.addActionListener(newActionListener(){

miPlay.addActionListener(newActionListener(){

playGame();

miPause.addActionListener(newActionListener(){

pauseGame();

miResume.addActionListener(newActionListener(){

resumeGame();

miStop.addActionListener(newActionListener(){

miCtrlBlock.addActionListener(newActionListener(){

{

reportGameMethod();

publicvoidreset()

ctrlPanel.reset();

canvas.reset();

publicbooleanisPlaying()

returnplaying;

publicErsBlockgetCurBlock()

returnblock;

publicGameCanvasgetCanvas()

returncanvas;

publicvoidplayGame()

play();

ctrlPanel.setPlayButtonEnable(false);

miPlay.setEnabled(false);

ctrlPanel.requestFocus();

publicvoidpauseGame()

if(block!

=null)

block.pauseMove();

ctrlPanel.setPauseButtonLabel(false);

miPause.setEnabled(false);

miResume.setEnabled(true);

publicvoidresumeGame()

=null)

block.resumeMove();

ctrlPanel.setPauseButtonLabel(true);

miPause.setEnabled(true);

miResume.setEnabled(false);

publicvoidstopGame()

playing=false;

block.stopMove();

miPlay.setEnabled(true);

ctrlPanel.setPlayButtonEnable(true);

publicintgetLevel()

returnctrlPanel.getLevel();

publicvoidsetLevel(intlevel)

if(level<

11&

&

level>

0)ctrlPanel.setLevel(level);

publicintgetScore()

if(canvas!

returncanvas.getScore();

return0;

publicintgetScoreForLevelUpdate()

returncanvas.getScoreForLevelUpdate();

publicbooleanlevelUpdate()

intcurLevel=getLevel();

if(curLevel<

maxlevel)

{

setLevel(curLevel+1);

canvas.resetScoreForLevelUpdate();

returntrue;

}

returnfalse;

privatevoidplay(){

reset();

playing=true;

Threadthread=newThread(newGame());

thread.start();

privatevoidreportGameMethod(){

JOptionPane.showMessageDialog(this,"

J为向左移动,L为向右移动,K为加速向下,I为翻转变化"

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

当前位置:首页 > IT计算机 > 电脑基础知识

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2