俄罗斯方块java源代码提供

上传人:ni****g 文档编号:487646253 上传时间:2023-09-11 格式:DOCX 页数:58 大小:169.06KB
返回 下载 相关 举报
俄罗斯方块java源代码提供_第1页
第1页 / 共58页
俄罗斯方块java源代码提供_第2页
第2页 / 共58页
俄罗斯方块java源代码提供_第3页
第3页 / 共58页
俄罗斯方块java源代码提供_第4页
第4页 / 共58页
俄罗斯方块java源代码提供_第5页
第5页 / 共58页
点击查看更多>>
资源描述

《俄罗斯方块java源代码提供》由会员分享,可在线阅读,更多相关《俄罗斯方块java源代码提供(58页珍藏版)》请在金锄头文库上搜索。

1、俄罗斯方块java源代码提供import java.awt.*;import java.awt.event.*;/俄罗斯方块类public class ERS_Block extends Framepublic static boolean isPlay=false;public static int level=l,score=0;public static Text Field scoreField,levelField;public static MyTimer timer;GameCanvas gameScr;public static void main(String argus)E

2、RS_Block ers = new ERS_Block(俄罗斯方块游戏 VI.0 Author:Vincent1);WindowListener win_listener = new WinListenerQ;ers.addWindowListener(win_listener);/俄罗斯方块类的构造方法ERS_Block(String title)super(title);setSize(600,480);setLayout(new GridLayout(l,2);gameScr = new GameCanvas();gameScr. addKey Listen er (gameScr);

3、timer = new MyTimer(gameScr);timer. setDaemon(true);timer. start();timer. suspendQ;add(gameScr);Panel rightScr = new PanelQ;rightScr.setLayout(new GridLayout(2,1,0,30);rightScr.setSize( 120,500);add (rightScr);/右边信息窗体的布局int temp = scr.getScrArrXY(row-i,col+j);if (temp 1;jreturn true;/同步显示的方法public s

4、ynchronized void dispBlock(int s)int k = 0x8000;for (int i = 0; i v 4; i+)for(int j = 0; j l;定时线程class MyTimer extends ThreadGameCanvas scr;public MyTimer(GameCanvas scr)this.scr = scr;public void run()while(true)(trysleep(10-ERS_Block.level + 1)*100);catch(InterruptedException e)if(!scr.getBlock().

5、fallDown()scr.deleteFullLineQ;if(scr.isGameEnd()ERS_Block.isPlay = false;suspend();elsescr.getBlockQ.reset();class WinListener extends WindowAdapterpublic void windowClosing (WindowEvent 1)System, exit (0);射击游戏代码效果玩家信息表:游戏帐号int昵称nchar(20)姓名nchar (10)性别nchar(2)出生日期datetime身份证号int城市nchar (10)-帐号属性表游戏帐

6、号int所属种族int所属职业int铠甲int兵器int级别int;经验值int种族对照表:种族编号int种族nchar(10)兵器封照表:兵器编号int兵器nchar (10)职业对照表,职业编号int职业nchar (10)铠甲对照表:铠甲编号int铠甲nchar (10)第一步:把如下代码加入区域中/ / Make arrayfunction MakeArray( n)this.length = n;for (var i = 1; i = n; i+) thisi = 0return this/ /poor mans random numbervar dO = new DateQ;var

7、 rO = d0.getSeconds();function poor_rand()dl = new DateQ;rO = (rO * rO + rO + dl.getSeconds() % 3721 ;return rO % width_n;/ /Parameters of gamevar height_n = 8;var width_n =5;/ / state of gamevar enemy = new MakeArray( width_n); / / enemy positionsvar wtime; / / wait timevar score; / / pointsvar gam

8、 eo ver; /in case of gam eo ver set to true/Make the battlefield.document.write( n”);document.write( n);document.write( Mn);document.write( Mn);for( var i=0; iheight_n; i+)document.write( nn);for( var j=O;jwidth_n; j+)document.write(nM);document.write( n);document.write( n);for( var j=O;jwidth_n; j+

9、)document.write( nv/TD”);document.write( n);document.write( Hn);document.write(n ”);document.write( KH);/ /game main timer event/ / enemy come one stepfunction come()(var n = poor_rand();document.fm2.elements width_n * enemyn+l + n.checked = true;enemyn+l+;if( enemyn+l height_n)(setTimeout(ncome()?

10、wtime);elsegameover = true;document.fm 1 .message.value = GAME OVER: + score ;/Fire the n th beamfunction fire( n)if( gameover ) return;for( var i=0; i 50) wtime -= 10;ij/ / initialize & start gamefunction game_start()for( var n=0; nwidth_n; n+)for( var i=0; ionLoad=Hdocument.forms0.guess.focus();第二

11、步:把vbody区域中的内容改为:劲舞团游戏代码第一步:把如下代码加入区域中SCRIPT LANGUAGES JavaScript、! Beginvar agt=navigator.userAgent.toLowerCase();if (agt.indexOf(macu) != -1)var a=r;elsevar a=rT;var max=O;function tlist() max=tlist.arguments.length;for (i=0; imax; i+)this i =tlist. arguments i;tl = new tlist(”o”+a+” /l”+a+”大/ *跳舞”+a,”o_”+a+” 跳舞+a,_o/*”+a+“ *+a+/ 跳舞+a,n *o_”+a+n / 知+a+n 跳舞+a,*

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 解决方案

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号