基本信息
源码名称:基于Java的雷电游戏源码(通俗易懂)
源码大小:0.30M
文件格式:.rar
开发语言:Java
更新时间:2020-06-19
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍


电脑游戏,是指在计算机上能够运转的游戏软件。这种软件具有较强的娱乐性。电脑游戏的创新和发展与硬件、软件的发展紧密相关。它能够给玩家提供一个虚拟的环境,使游戏带给了人们很多的享受和欢乐。雷电游戏因为操作简单,节奏明快,一直是纵轴射击游戏的经典之作。经常能够在手机或者计算机中见到这款游戏,深得广大玩家的喜爱,可以说是妇孺皆知的一款益智类游戏。

   本游戏基于Eclipse开发平台,以java作为编程语言,整个项目开发旨在模拟雷电游戏的飞机射击游戏。游戏界面的下部是玩家的飞机,可以根据按键控制子弹的发射,上部为敌方飞机,在界面中随机出现。在游戏过程当中,用户飞机的移动是被电脑键盘的方向键所控制的,在整个游戏过程当中,如果用户飞机的子弹与敌方飞机发生相撞时,敌方飞机就会有爆炸的效果产生。游戏中使用到的飞机、子弹均采用对应的类实现。


public final void paint(Graphics 9) {
g. setColor(this. bgColor);
g. fillRect(x, y, width, height);
g. setColor(this. fgColor);
g. drawRect(x, y, width, height);
this. paintBoxContents(g);}
private void paintBlock
(int x, int y, int blockType, Graphics 9) {
int blockX = this boardX (this blockSize * x);
int blockY =this . boardY (this. blockSize*
(y-TetrisConstants. TOP _VISIBLE ROW);
if(TetrisConstants. BLOCK_EMPTY != blockType) {
g. setColor(TetrisConstants. COLOR__BLACK);
g. fillRect(blockX 1, blockY 1, this. blockSize -1,
this. blockSize -1);
this. setColor(blockType, g);
g. fillRect(blockX, blockY, this. blockSize -1,
this. blockSize -1);
} else {
g. setColor(TetrisConstants. COLOR _WHITE);
g. fillRect(blockX, blockY, this. blockSize,
this. blockSize);
}
}




private int clearCompletedRows(TetrisPiece piece) {
TetrisBoard board = this. getBoard0;
for(inti= 0;i < TetrisConstants. FOUR BLOCKS; i ){
int rowY = piece. getBlockY();
if(board. checkRowCompleted(rowY) {
this. markRowCompleted(rowY, true);
}
}
int numClearedRows = 0;
for(inty = TetrisConstants. HEIGHT -1;y>= 0;y--) {
if(numClearedRows> 0) {
board. dropRow(y, numClearedRows);
-o
if(this. isRowCompleted() {
numClearedRows ;
this. markRowCompleted(y, false);
for(inti= 0; i < numClearedRows; i ){
board. clearRow();
}
return numClearedRows;