莫相离 发表于 2015-1-18 11:18:46

JAVA教程之Javascript Game

再说第三点:我并没有提到服务器也要整合,然后是IDE,一个好的IDE能够200%提高开发的速度,就说图形方面:你是经过简单托拽和点击就能实现功能好那。<HTML>
<HEAD>
<TITLE>JSFALCON</TITLE>
<SCRIPTLANGUAGE="JavaScript">
<!--
varFlimit=9//forTESTPLAY(FireLimit0to9)
varBossTM=0//(Bosstestmode=1)
varBossLM=700//(Bossappearance)
varEasy=0
vartimerID=null
varTimeCounter=0
varINT=25//interval
vark=0//keybuffer
varX=100//mychrXY
varY=100
varDX=0//mychrmove
varDY=0
varIX=0
varIY=0
varSDX=0
varSDY=0
varSIX=0
varSIY=0
varEndflg=0//GameEndFlag
varff=0//fireflag
varfc=0//firecounter
varFX=newArray(12)//fireXY
varFY=newArray(12)
varbf=0//bombflag
varbc=0//bombcounter
varBX=0//bombXY
varBY=-100
varBDX=0//bombfallspeed
varBDY=0
varCname=newArray(2)//clashimageNo
varBflag=0//bombFLAG
varGND=0//scrollflag
varEFX=newArray(8)//enemyfireXY
varEFY=newArray(8)
varEVX=newArray(8)//enemyfirespeed
varEVY=newArray(8)
varFmax=3//enemyfiremax
varEMX=200//enemymissileXY
varEMY=284
varPTN=0//enemymissilepaturn
varMvx=0//enemymissilespeed
varMvy=0
varmCount=100//missiletimer
varEX=newArray(20)//enemyXY
varEY=newArray(20)
varCH=newArray(2)//cobraYspeed
varCW=newArray(2)//cobraXspeed
vartmp1=0
vartmp2=0
varEndflg=1
varBossflg=0
varBossX=0//BossX
varBossH=0//BossCanonH(170to220)
varCanonX=-200//CanonX,Y,counter
varCanonY=-200
varCanonC=0
varBossflg=0
vartmpBF=0
varsf=0//Startflag
varspCOUNT=0

//IEcheck
systm=""
ver=navigator.appVersion
len=ver.length
for(iln=0;iln<len;iln++)if(ver.charAt(iln)=="(")break
systm=ver.charAt(iln+1).toUpperCase()

//---------------------------------
//========Mainfunction==========
//---------------------------------
functioninterval1(){
clearTimeout(timerID)
//---------Clashimageclear-----------
ccount0=ccount0+1
if(ccount0>=2){cla0.left=-100}
ccount1=ccount1+1
if(ccount1>=2){cla1.left=-100}
ccount2=ccount2+1
if(ccount2>=2){cla2.left=-100}
//---------Enemyfirelevelup-----------
TimeCounter=TimeCounter+1
with(Math){Fmax=floor(TimeCounter/100)+3}
if(Fmax>=Flimit){Fmax=Flimit}
if(TimeCounter==Blimit){Bossflg=1;tmpbgc=100;tmpbgf=0}
if(Bossflg>=1){
tmpbgc=tmpbgc-5
if(tmpbgc>=0){
if(systm!="C"){}
}
if(tmpbgf==0){
if(tmpbgc<=0){
if(systm!="C"){
tmpbgf=1
}else{
tmpbgf=1
}
}
}
tmpBF=0
for(tmp1=0;tmp1<10;tmp1++){
if(EX>=-50){tmpBF=1}
}
if(tmpBF==0){BossMode()}
}

//---------GNDmove----------
GND=GND-1;if(GND<=-16){GND=0}
GNDs.left=GND

//----------Mig23moveenemyNo=0,1,2LayerNo=27,28,29---------
with(Math){
for(tmp1=0;tmp1<3;tmp1++){
EX=EX-5
if(EX<=-30){
if(floor(random()*12)==3){
if(Bossflg==0){EX=400;EY=floor(random()*12)*20+20}
}
}
spMOV(27+tmp1,EX,EY)
with(Math){if(floor(random()*5)==3){Efire(EX,EY)}}
}
}
//----------cobramoveenemyNo=3,4,5LayerNo=30,31,32----------
if(TimeCounter>=300){
with(Math){
for(tmp1=3;tmp1<6;tmp1++){
EX=EX-CW
if(EY<=5){CH=2;CW=4}
if(EY>=240){CH=-2;CW=2}
EY=EY+CH
if(EX<=-30){
if(floor(random()*12)==3){
if(Bossflg==0){EX=400;EY=floor(random()*12)*20+20}
}
}
spMOV(27+tmp1,EX,EY)
with(Math){if(floor(random()*5)==3){Efire(EX,EY)}}
}
}
}
//----------shilkamoveenemyNo=6,7,8LayerNo=33,34,35----------
if(TimeCounter>=200){
with(Math){tmpTM=TimeCounter-floor(TimeCounter/100)*100}
if(tmpTM<=40){tmpTMX=3}else{if(tmpTM<=70){tmpTMX=1}else{tmpTMX=-1}}
for(tmp1=0;tmp1<3;tmp1++){
EX=EX-tmpTMX
if(EX<=-30){
if(EX<=365){
if(EX<=365){
if(EX<=365){
if(Bossflg==0){
with(Math){if(floor(random()*40)==3){EX=400}}
}
}
}
}
}
spMOV(33+tmp1,EX,EY)
with(Math){if(floor(random()*5)==3){Efire(EX,EY)}}
}
}
//----------geckomoveenemyNo=9LayerNo=36------------
if(EX<=-600){if(Bossflg==0){EX=400}}
EX=EX-1;if(EX<=250){EX=EX-4}
if(EX==365){EMX=EX+7;EMY=EY-10;mCount=0}
if(EX==310){EMX=EX+7;EMY=EY-10;mCount=0}
if(EX==255){EMX=EX+7;EMY=EY-10;mCount=0}
spMOV(36,EX,EY)
//----------bombmove-------------
if(bf==1){BX=X;BY=Y+30;bc=1;bf=0;BDX=12}
if(bc==1){
BDY=BDY+2
if(BDY==10){
spMOV(45+Bflag,-100,-100)
Bflag=1
}
if(BDY>=10){BDX=BDX+3;BX=BX+BDX}
BY=BY+BDY;tmpBMX=-100;tmpBMY=-100
for(tmp2=0;tmp2<10;tmp2++){
if(BX>=EX-30){
if(BX<=EX+16){
if(BY>=EY-3){
if(BY<=EY+16){
tmpBMX=BX-8;tmpBMY=BY-4
}
}
}
}
}
if(BY>=284){tmpBMX=BX-8;tmpBMY=244}
if(tmpBMX!=-100){
spMOV(45+Bflag,-100,-100)
spMOV(50,tmpBMX,tmpBMY)
Bflag=0;ccount2=0;bc=0;BY=-100;BDX=0;BDY=0
for(tmp2=0;tmp2<10;tmp2++){
if(BX>=EX-56){
if(BX<=EX+40){
if(EY>=tmpBMY-18){
if(EY<=tmpBMY+63){
spMOV(33+tmp2,-100,-100)
spMOV(Cname,EX,EY-6)
if(cflag==0){ccount0=0}else{ccount1=0}
cflag=cflag+1;if(cflag>=2){cflag=0}
EX=-100;FX=500;score=score+50
}
}
}
}
}
}
spMOV(45+Bflag,BX,BY)
}
//----------Myfiremove-------------
if(ff==1){
FX=X;FY=Y+12
fc=fc+1;if(fc>=13){fc=0}
ff=0
}
for(tmp1=0;tmp1<13;tmp1++){
FX=FX+32
for(tmp2=0;tmp2<10;tmp2++){
if(FX>=EX-8){
if(FX<=EX+32){
if(FY>=EY-8){
if(FY<=EY+19){
spMOV(27+tmp2,-100,-100)
spMOV(Cname,EX,EY-6)
if(cflag==0){ccount0=0}else{ccount1=0}
cflag=cflag+1;if(cflag>=2){cflag=0}
EX=-100;FX=500;score=score+10
}
}
}
}
}
spMOV(tmp1+1,FX,FY)
}

//----------EnemyFire/MissileMove---------
Efmove()
Emiss()
//----------mychrmove-----------
tmpIX=IX+SIX;if(tmpIX>=1){tmpIX=5+Easy}
tmpIY=IY+SIY;if(tmpIY>=1){tmpIY=5+Easy}
tmpDX=DX+SDX;if(tmpDX>=1){tmpDX=5+Easy}
tmpDY=DY+SDY;if(tmpDY>=1){tmpDY=5+Easy}
X=X+tmpIX-tmpDX
Y=Y+tmpIY-tmpDY
if(X>=368){X=368}
if(X<=0){X=0}
if(Y<=0){Y=0}
if(Y>=258){
mycr.visibility="hidden"
DOC2c.visibility="hidden"
DOCc.visibility="visible"
spMOV(Cname,X,Y)
Endflg=1;EFX=-100;cflag=cflag+1;if(cflag>=2){cflag=0}
}
for(tmp2=0;tmp2<10;tmp2++){
if(X>=EX-20){
if(X<=EX+20){
if(Y>=EY-20){
if(Y<=EY+10){
mycr.visibility="hidden"
DOC2c.visibility="hidden"
DOCc.visibility="visible"
spMOV(Cname,X,Y)
Endflg=1;EFX=-100;cflag=cflag+1;if(cflag>=2){cflag=0}
}
}
}
}
}
spMOV(0,X,Y)
//scoreshow
with(Math){
s5=floor(score/10000)
s4=floor((score-s5*10000)/1000)
s3=floor((score-s5*10000-s4*1000)/100)
s2=floor((score-s5*10000-s4*1000-s3*100)/10)
s1=score-s5*10000-s4*1000-s3*100-s2*10
}
L7c.top=-16*s5
L8c.top=-16*s4
L9c.top=-16*s3
L10c.top=-16*s2
L11c.top=-16*s1
//--------timerset----------
if(Endflg!=1){timerID=setTimeout("interval1()",INT)
}else{
if(systm!="C"){
}else{
}
if(hscore<=score){
document.cookie="JSFALCON="+score+";expires=Fri.31-Dec-199923:59:59GMT"
hscore=score
loadSCORE()
}
}
}

//---------------------------
//======SubFunctions======
//---------------------------
//-----------OnLoad----------
functiononLD(){
if(systm!="C"){
W1c=document.layers["W1"]
mycr=W1c.layers["Mychr"]
cla0=W1c.layers["clash"]
cla1=W1c.layers["clash1"]
cla2=W1c.layers["clash2"]
GNDs=W1c.layers["GND"]
DOCc=W1c.layers["doc"]
DOC2c=W1c.layers["doc2"]
EAS=W1c.layers["EASY"]
BOS0=W1c.layers["boss0"]
BOS1=W1c.layers["boss1"]
BOSR=W1c.layers["bossR"]
L2c=document.layers
L3c=document.layers
L4c=document.layers
L5c=document.layers
L6c=document.layers
L7c=document.layers
L8c=document.layers
L9c=document.layers
L10c=document.layers
L11c=document.layers
}else{
W1c=document.all.W1.style
mycr=document.all.W1.document.all.Mychr.style
cla0=document.all.W1.document.all.clash.style
cla1=document.all.W1.document.all.clash1.style
cla2=document.all.W1.document.all.clash2.style
GNDs=document.all.W1.document.all.GND.style
DOCc=document.all.W1.document.all.doc.style
DOC2c=document.all.W1.document.all.doc2.style
EAS=document.all.W1.document.all.EASY.style
BOS0=document.all.W1.document.all.boss0.style
BOS1=document.all.W1.document.all.boss1.style
BOSR=document.all.W1.document.all.bossR.style
L2c=L2I.style
L3c=L3I.style
L4c=L4I.style
L5c=L5I.style
L6c=L6I.style
L7c=L7I.style
L8c=L8I.style
L9c=L9I.style
L10c=L10I.style
L11c=L11I.style
W1c.clip="rect(118,400,418,0)"
}

loadSCORE()
sf=1
QuitPlay()
}
//----------EasyMode---------
functionEASY(){
Easy=1
EAS.visibility="visible"
}
//----------NormalMode---------
functionNORMAL(){
Easy=0
EAS.visibility="hidden"
}
//----------BossMode---------
functionBossMode(){
if(Bossflg==1){
BossX=BossX-10
if(BossX==250){
Bossflg=3
if(Flimit!=0){EMX=BossX+30;EMY=218;mCount=0}
EVX=-5;EVY=-5
EVX=-6;EVY=-4
EVX=-4;EVY=-6
EVX=-2;EVY=-7
EVX=-7;EVY=-7
EFX=BossX+101;EFY=225
EFX=BossX+98;EFY=229
EFX=BossX+104;EFY=222
EFX=BossX+109;EFY=222
EFX=BossX+7;EFY=232
}
if(BossX==0){Bossflg=2}
}
if(Bossflg==2){
BossX=BossX+10
if(BossX==150){
Bossflg=6
EVX=-5;EVY=-5
EVX=-6;EVY=-4
EVX=-4;EVY=-6
EVX=-2;EVY=-7
EVX=-7;EVY=-7
EFX=BossX+101;EFY=225
EFX=BossX+98;EFY=229
EFX=BossX+104;EFY=222
EFX=BossX+109;EFY=222
EFX=BossX+7;EFY=232
}
if(BossX==270){Bossflg=1}
}
BOS0.left=BossX
if(Bossflg==3){
BossH=BossH-5
if(BossH==170){Bossflg=4;CanonC=0}
}
if(Bossflg==4){
if(CanonC==0){CanonX=BossX+55;CanonY=195;CanonC=1}else{
CanonC=CanonC+1;if(CanonC==10){Bossflg=5}
}
}
if(Bossflg==5){
BossH=BossH+5
if(BossH==220){Bossflg=1}
}
if(Bossflg==6){
BossH=BossH-5
if(BossH==170){Bossflg=7;CanonC=0}
}
if(Bossflg==7){
if(CanonC==0){CanonX=BossX+55;CanonY=195;CanonC=1}else{
CanonC=CanonC+1;if(CanonC==10){Bossflg=8}
}
}
if(Bossflg==8){
BossH=BossH+5
if(BossH==220){Bossflg=2}
}
if(BossH==220){tmpBHx=-200}else{tmpBHx=BossX+30}
CanonX=CanonX-25;CanonY=CanonY-25
spMOV(15,tmpBHx,BossH)
spMOV(14,CanonX,CanonY)
Fmax=Flimit;Efmove()
//Bosscheck1
for(tmp2=0;tmp2<10;tmp2++){
if(X>=BossX-20){
if(X<=BossX+124){
if(Y>=188){
mycr.visibility="hidden"
DOC2c.visibility="hidden"
DOCc.visibility="visible"
spMOV(Cname,X,Y)
Endflg=1;cflag=cflag+1;if(cflag>=2){cflag=0}
}
}
}
}
//bosscheck2
for(tmp2=0;tmp2<10;tmp2++){
if(X>=BossX+20){
if(X<=BossX+105){
if(Y>=BossH-16){
mycr.visibility="hidden"
DOC2c.visibility="hidden"
DOCc.visibility="visible"
spMOV(Cname,X,Y)
Endflg=1;cflag=cflag+1;if(cflag>=2){cflag=0}
}
}
}
}
Cchkflg=0
//Canoncheck1
if(X>=CanonX-16){
if(X<=CanonX+16){
if(Y>=CanonY-16){
if(Y<=CanonY+16){
Cchkflg=1
}
}
}
}
//Canoncheck2
if(X>=CanonX){
if(X<=CanonX+34){
if(Y>=CanonY){
if(Y<=CanonY+34){
Cchkflg=1
}
}
}
}
if(Cchkflg==1){
mycr.visibility="hidden"
DOC2c.visibility="hidden"
DOCc.visibility="visible"
spMOV(Cname,X,Y)
Endflg=1;cflag=cflag+1;if(cflag>=2){cflag=0}
}
//Myfireclear
spMOV(47,-100,-100)
for(tmp1=0;tmp1<13;tmp1++){
if(FX>=BossX-8){
if(FX<=BossX+128){
if(FY>=216){
FX=500
spMOV(47,BossX,FY)
}
}
}
}
for(tmp1=0;tmp1<13;tmp1++){
if(FX>=BossX+38){
if(FX<=BossX+70){
if(FY>=BossH-4){
if(FY<216){
FX=500
spMOV(47,BossX+38,FY)
}
}
}
}
}
//Bombcheck
tmpBMX=-100
if(BX>=BossX-30){
if(BX<=BossX+144){
if(BY>=216){
tmpBMX=BX-8;tmpBMY=BY-4
}
}
}
if(BX>=BossX+2){
if(BX<=BossX+94){
if(BY>=BossH-4){
tmpBMX=BX-8;tmpBMY=BY-4
}
}
}
if(BY>=284){tmpBMX=BX-8;tmpBMY=244}
if(tmpBMX!=-100){
spMOV(45+Bflag,-100,-100)
spMOV(50,tmpBMX,tmpBMY)
Bflag=0;ccount2=0;bc=0;BY=-100;BDX=0;BDY=0
if(BossH!=220){
if(tmpBMX>=BossX+25){
if(tmpBMX<=BossX+108){
if(tmpBMY<=BossH+22){
if(tmpBMY<=219){
DOC2c.visibility="visible"
BOS1.left=-200
spMOV(16,tmpBHx,BossH)
Endflg=1;score=score+Flimit*1000
}
}
}
}
}
}

}
//----------Quit-------------
functionQuitPlay(){
focus()
Endflg=1
DOC2c.visibility="hidden"
DOCc.visibility="visible"
clearTimeout(timerID)
}

//-----------Restart---------
functionRestart(){
DOCc.visibility="hidden"
DOC2c.visibility="hidden"
for(tmp1=0;tmp1<50;tmp1++){spLEFT(tmp1,-200)}
for(tmp1=0;tmp1<10;tmp1++){EX=0;EY=0}
if(systm!="C"){
}else{
}
TimeCounter=0
score=0
Cname=48
Cname=49
Cname=50
cflag=0
Bossflg=BossTM
BossX=400
BossH=220
Blimit=BossLM
CanonX=-200
CanonY=-200
CanonC=0
X=100
Y=100
DX=0
DY=0
IX=0
IY=0
SDX=0
SDY=0
SIX=0
SIY=0
Endflg=0
ff=0
fc=0
ccount0=0
ccount1=0
ccount2=0
for(tmp1=0;tmp1<13;tmp1++){FX=0;FY=-100}
bf=0
bc=0
BX=0
BY=-100
BDX=0
BDY=0
Bflag=0
GND=0
Mvx=0
Mvy=0
mCount=100
Fmax=3
for(tmp1=0;tmp1<9;tmp1++){EFX=-100;EFY=-100
spMOV(tmp1+18,EFX,EFY)
}
tmpE0=0
for(tmp1=0;tmp1<3;tmp1++){
with(Math){EX=460+floor(random()*200)}
with(Math){EY=floor(random()*12)*20+20}
}
EX=400;EX=440;EX=520
EY=100;EY=60;EY=200
CH=2;CH=-2;CH=-2
CW=4;CW=2;CW=2
for(tmp1=0;tmp1<3;tmp1++){
spMOV(tmp1+30,EX,EY)
}
EX=400;EX=496;EX=530;EX=500
for(tmp1=0;tmp1<4;tmp1++){
EY=260
spMOV(tmp1+33,EX,EY)
}
spMOV(45,-100,-100)
spMOV(46,-100,-100)
mycr.visibility="visible"
if(BossTM!=0){for(tmp1=0;tmp1<10;tmp1++){EX=-100;Blimit=5}}
timerID=setTimeout("interval1()",INT)
}
//---------EnemyMissileLayerNo37to44-----------
functionEmiss(){
mCount=mCount+1
if(mCount==50){
spLEFT(37+PTN,-100)
spMOV(Cname,EMX-4,EMY-4)
if(cflag==0){ccount0=0}else{ccount1=0}
cflag=cflag+1;if(cflag>=2){cflag=0}
if(X>=EMX-28){
if(X<=EMX+24){
if(Y>=EMY-28){
if(Y<=EMY+24){
mycr.visibility="hidden"
DOC2c.visibility="hidden"
DOCc.visibility="visible"
spMOV(Cname,X,Y)
Endflg=1;EFX=-100;cflag=cflag+1;if(cflag>=2){cflag=0}
}
}
}
}
}
if(mCount<50){
tmpEMX=X-EMX;tmpEMY=EMY-Y
tmpPTN=PTN
if(tmpEMX==0){tmpEMX=1}
if(tmpEMY==0){tmpEMY=1}
tmpTx=tmpEMY/tmpEMX
if(tmpEMX>0){
if(tmpTx>2.4142){PTN=2;Mvx=Mvx/1.4;Mvy=Mvy+0.7}else{
if(tmpTx>0.4142){PTN=3;Mvx=Mvx+0.5;Mvy=Mvy+0.5}else{
if(tmpTx>-0.4142){PTN=4;Mvx=Mvx+0.7;Mvy=Mvy/1.4}else{
if(tmpTx>-2.4142){PTN=5;Mvx=Mvx+0.5;Mvy=Mvy-0.5}else{
PTN=6;Mvx=Mvx/1.4;Mvy=Mvy-0.7
}
}
}
}
}else{
if(-tmpTx>2.4142){PTN=2;Mvx=Mvx/1.4;Mvy=Mvy+0.7}else{
if(-tmpTx>0.4142){PTN=1;Mvx=Mvx-0.5;Mvy=Mvy+0.5}else{
if(-tmpTx>-0.4142){PTN=0;Mvx=Mvx-0.7;Mvy=Mvy/1.4}else{
if(-tmpTx>-2.4142){PTN=7;Mvx=Mvx-0.5;Mvy=Mvy-0.5}else{
PTN=6;Mvx=Mvx/1.4;Mvy=Mvy-0.7
}
}
}
}
}
if(mCount<=5){PTN=1;Mvx=Mvx-0.5;Mvy=Mvy+0.5}
if(Mvx>=5){Mvx=5}
if(Mvy>=5){Mvy=5}
if(Mvx<=-5){Mvx=-5}
if(Mvy<=-5){Mvy=-5}
EMX=EMX+Mvx-1;EMY=EMY-Mvy
spLEFT(37+tmpPTN,-100)
spMOV(37+PTN,EMX,EMY)
if(X>=EMX-24){
if(X<=EMX+20){
if(Y>=EMY-24){
if(Y<=EMY+20){
spLEFT(37+PTN,-100)
spMOV(Cname,EMX-4,EMY-4)
cflag=cflag+1;if(cflag>=2){cflag=0}
mycr.visibility="hidden"
DOC2c.visibility="hidden"
DOCc.visibility="visible"
spMOV(Cname,X,Y)
cflag=cflag+1;if(cflag>=2){cflag=0}
Endflg=1;EFX=-100
}
}
}
}
}
}
//---------EnemyfiremoveLayerNo=17to25-------------
functionEfmove(){
for(tmp1=0;tmp1<Fmax;tmp1++){
if(EFX!=-100){
EFX=EFX+EVX;EFY=EFY+EVY
if(EFX<-16){EFX=-100;EVX=0;EVY=0}
if(EFX>400){EFX=-100;EVX=0;EVY=0}
if(EFY<-16){EFX=-100;EVX=0;EVY=0}
if(EFY>300){EFX=-100;EVX=0;EVY=0}
}
if(EFX>=X-4){
if(EFX<=X+26){
if(EFY>=Y+8){
if(EFY<=Y+24){
mycr.visibility="hidden"
DOC2c.visibility="hidden"
DOCc.visibility="visible"
spMOV(Cname,X,Y)
Endflg=1;EFX=-100;cflag=cflag+1;if(cflag>=2){cflag=0}
}
}
}
}
spMOV(tmp1+18,EFX,EFY)
}
}
//---------EnemyFireLayerNo=17to25-----------
functionEfire(EPX,EPY){
if(Bossflg==0){
tmpE0=tmpE0+1;if(tmpE0>=9){tmpE0=0}
if(EFX==-100){
EFX=EPX;EFY=EPY
tmpEx=X-EPX;tmpEy=Y-EPY
with(Math){
tmpEr=sqrt(tmpEx*tmpEx+tmpEy*tmpEy)
if(tmpEr==0){tmpEr=1}
EVX=floor((tmpEx/tmpEr)*7);EVY=floor((tmpEy/tmpEr)*7)
}
}
}
}

//------HIGHSCOREshow------
functionloadSCORE(){
if(document.cookie){
FALCONtop=document.cookie.indexOf("JSFALCON",0)
if(FALCONtop!=-1){
tscore=document.cookie.substring(FALCONtop+9,FALCONtop+14)
}else{tscore="0"}
}else{tscore="0"}
with(Math){
hscore=parseInt(tscore,10)
h5=floor(hscore/10000)
h4=floor((hscore-h5*10000)/1000)
h3=floor((hscore-h5*10000-h4*1000)/100)
h2=floor((hscore-h5*10000-h4*1000-h3*100)/10)
h1=hscore-h5*10000-h4*1000-h3*100-h2*10
}
L2c.top=-16*h5
L3c.top=-16*h4
L4c.top=-16*h3
L5c.top=-16*h2
L6c.top=-16*h1
}

//------KeyDown------
functionkeyDown(DnEvents){
if(systm!="C"){
k=DnEvents.which
}else{
k=window.event.keyCode
}
if(k==50){IY=1}//2
if(k==56){DY=1}//8
if(k==54){IX=1}//6
if(k==52){DX=1}//4
if(k==98){IY=1}//2
if(k==104){DY=1}//8
if(k==102){IX=1}//6
if(k==100){DX=1}//4
if(k==75){IY=1}//K
if(k==73){DY=1}//I
if(k==76){IX=1}//L
if(k==74){DX=1}//J
if(k==107){IY=1}//k
if(k==105){DY=1}//i
if(k==108){IX=1}//l
if(k==106){DX=1}//j
if(k==49){SDX=1;SIY=1}//1
if(k==51){SIX=1;SIY=1}//3
if(k==55){SDX=1;SDY=1}//7
if(k==57){SIX=1;SDY=1}//9
if(k==32){ff=1}//spc
if(k==90){ff=1}//Z
if(k==122){ff=1}//z
if(k==0){ff=1}//shiftCtrlCapsetc..
if(k==48){if(bc==0){bf=1}}//0
if(k==96){if(bc==0){bf=1}}//0
if(k==13){if(bc==0){bf=1}}//Enter
if(k==88){if(bc==0){bf=1}}//X
if(k==120){if(bc==0){bf=1}}//x
if(k==83){if(Endflg==1){if(sf==1){Restart()}}}//S
if(k==115){if(Endflg==1){if(sf==1){Restart()}}}//s
if(k==69){if(Endflg==1){Flimit=3;EASY()}}//E
if(k==101){if(Endflg==1){Flimit=3;EASY()}}//e
if(k==78){if(Endflg==1){Flimit=9;NORMAL()}}//N
if(k==110){if(Endflg==1){Flimit=9;NORMAL()}}//n
if(k==81){QuitPlay()}//Q
if(k==113){QuitPlay()}//q
}
//-------KeyUp--------
functionkeyUp(UpEvents){
if(systm!="C"){
k=UpEvents.which
}else{
k=window.event.keyCode
}
if(k==50){IY=0}
if(k==56){DY=0}
if(k==54){IX=0}
if(k==52){DX=0}
if(k==98){IY=0}//2
if(k==104){DY=0}//8
if(k==102){IX=0}//6
if(k==100){DX=0}//4
if(k==75){IY=0}//K
if(k==73){DY=0}//I
if(k==76){IX=0}//L
if(k==74){DX=0}//J
if(k==107){IY=0}//k
if(k==105){DY=0}//i
if(k==108){IX=0}//l
if(k==106){DX=0}//j

if(k==49){SDX=0;SIY=0}
if(k==51){SIX=0;SIY=0}
if(k==55){SDX=0;SDY=0}
if(k==57){SIX=0;SDY=0}
}
//--------LAYERSETUP----------
functionspINI(spNAME,spX,spY,spW,spH,spIMG){
if(systm!="C"){
document.layers["W1"].document.write("<LAYERNAME="+spNAME+"LEFT="+spX+"TOP="+spY+"></LAYER>")
}else{
with(document){
write("
<DIVID="BG"></DIV>

<DIVSTYLE=position:absolute;left:16;top:0></DIV>
<DIVSTYLE=position:absolute;left:60;top:0></DIV>
<DIVID="L2I"STYLE=position:absolute;left:120;top:0>
</DIV>
<DIVID="L3I"STYLE=position:absolute;left:130;top:0>
</DIV>
<DIVID="L4I"STYLE=position:absolute;left:140;top:0>
</DIV>
<DIVID="L5I"STYLE=position:absolute;left:150;top:0>
</DIV>
<DIVID="L6I"STYLE=position:absolute;left:160;top:0>
</DIV>
<DIVSTYLE=position:absolute;left:290;top:0></DIV>
<DIVID="L7I"STYLE=position:absolute;left:350;top:0>
</DIV>
<DIVID="L8I"STYLE=position:absolute;left:360;top:0>
</DIV>
<DIVID="L9I"STYLE=position:absolute;left:370;top:0>
</DIV>
<DIVID="L10I"STYLE=position:absolute;left:380;top:0>
</DIV>
<DIVID="L11I"STYLE=position:absolute;left:390;top:0>
</DIV>
<DIVSTYLE=position:absolute;left:16;top:16>

</DIV>

<DIVID="TITL"STYLE=position:absolute;left:424;top:16>
<PRE>
<FONTCOLOR="#FFFF00"SIZE="+2"><B>JSFALCON</B></FONT>
<AHREF="javascript:history.back()">BACK</A>
</PRE>
</DIV>

<DIVID="KEYS"STYLE=position:absolute;left:16;top:320><PRE><FONTSIZE="-1">Move..2,4,6,8orK,J,L,I/Fire..SPACEorZ/Bomb..0orX</FONT></PRE></DIV>

<DIVID="W1"STYLE=position:absolute;left:16;top:16;clip:rect(0,400,300,0)>
<SCRIPTLANGUAGE="JavaScript">
<!--
spINI("Mychr",100,100,32,32,"f16c.gif")
spINI("MyF01",-100,0,32,8,"fire0c.gif")
spINI("MyF02",-100,0,32,8,"fire0c.gif")
spINI("MyF03",-100,0,32,8,"fire0c.gif")
spINI("MyF04",-100,0,32,8,"fire0c.gif")
spINI("MyF05",-100,0,32,8,"fire0c.gif")
spINI("MyF06",-100,0,32,8,"fire0c.gif")
spINI("MyF07",-100,0,32,8,"fire0c.gif")
spINI("MyF08",-100,0,32,8,"fire0c.gif")
spINI("MyF09",-100,0,32,8,"fire0c.gif")
spINI("MyF10",-100,0,32,8,"fire0c.gif")
spINI("MyF11",-100,0,32,8,"fire0c.gif")
spINI("MyF12",-100,0,32,8,"fire0c.gif")
spINI("MyF13",-100,0,32,8,"fire0c.gif")
spINI("boss2",-180,120,50,50,"boss2c.gif")
spINI("boss1",-230,170,80,50,"boss1c.gif")
spINI("bossR",-230,170,80,50,"boss1rc.gif")
spINI("boss0",-200,220,128,64,"boss0c.gif")
spINI("EnF1",-100,0,8,8,"fire1c.gif")
spINI("EnF2",-100,0,8,8,"fire1c.gif")
spINI("EnF3",-100,0,8,8,"fire1c.gif")
spINI("EnF4",-100,0,8,8,"fire1c.gif")
spINI("EnF5",-100,0,8,8,"fire1c.gif")
spINI("EnF6",-100,0,8,8,"fire1c.gif")
spINI("EnF7",-100,0,8,8,"fire1c.gif")
spINI("EnF8",-100,0,8,8,"fire1c.gif")
spINI("EnF9",-100,0,8,8,"fire1c.gif")
spINI("M231",-100,0,32,19,"m23c.gif")
spINI("M232",-100,0,32,19,"m23c.gif")
spINI("M233",-100,0,32,19,"m23c.gif")
spINI("cob1",-100,0,32,19,"cobrac.gif")
spINI("cob2",-100,0,32,19,"cobrac.gif")
spINI("cob3",-100,0,32,19,"cobrac.gif")
spINI("shi1",-100,0,32,24,"shilkac.gif")
spINI("shi2",-100,0,32,24,"shilkac.gif")
spINI("shi3",-100,0,32,24,"shilkac.gif")
spINI("sa81",-100,0,32,24,"sa8c.gif")
spINI("msl0",-100,0,24,24,"msl0c.gif")
spINI("msl1",-100,0,24,24,"msl1c.gif")
spINI("msl2",-100,0,24,24,"msl2c.gif")
spINI("msl3",-100,0,24,24,"msl3c.gif")
spINI("msl4",-100,0,24,24,"msl4c.gif")
spINI("msl5",-100,0,24,24,"msl5c.gif")
spINI("msl6",-100,0,24,24,"msl6c.gif")
spINI("msl7",-100,0,24,24,"msl7c.gif")
spINI("bom0",-100,0,32,8,"bom0c.gif")
spINI("bom1",-100,0,32,8,"bom1c.gif")
spINI("miss",-100,0,16,16,"clashc.gif")
spINI("clash",-100,0,32,32,"clashc.gif")
spINI("clash1",-100,0,32,32,"clashc.gif")
spINI("clash2",-100,0,64,64,"clash2c.gif")

//-->
</SCRIPT>

<DIVID="GND"STYLE=position:absolute;left:0;top:284></DIV>
<DIVID="doc"STYLE=position:absolute;left:0;top:150;visibility:hidden>
<PRE>
Full<FONTCOLOR="#0000FF">KEYBOARD</FONT>operation
Start/Restart..<FONTCOLOR="#FF0000">Hit<B>S</B>key!</FONT>
<FONTSIZE="-1">(EasyMode..E/NormalMode..N)</FONT>
</PRE>
</DIV>
<DIVID="doc2"STYLE=position:absolute;left:0;top:150;visibility:hidden>
<PRE>
<FONTCOLOR="#0000FF"SIZE="+1"><B>MISSIONCOMPLETE</B></FONT>
Doyouplayagain?..<FONTCOLOR="#FF0000">Hit<B>S</B>key!</FONT>
<FONTSIZE="-1">(EasyMode..E/NormalMode..N)</FONT>
</PRE>
</DIV>
<DIVID="EASY"STYLE=position:absolute;left:2;top:2;visibility:hidden>
<FONTCOLOR="#FF0000"SIZE="-1">EASYMODE</FONT>
</DIV>
</DIV>
</BODY>
</HTML>


用winrar打包j2ee的程序和用IDE打包应用程序是一样的。按照你的想法,你是不是也希望服务器都整合由一家公司提供呢?

若相依 发表于 2015-1-20 19:57:44

你快去找一份Java的编程工作来做吧(如果是在校学生可以去做兼职啊),在实践中提高自己,那才是最快的。不过你得祈祷在公司里碰到一个高手,而且他 还愿意不厌其烦地教你,这样好象有点难哦!还有一个办法就是读开放源码的程序了。我们知道开放源码大都出自高手,他们设计合理,考虑周到,再加上有广大的程序员参与,代码的价值自然是字字珠叽,铿锵有力(对不起,偶最近《金装四大才子》看多了)。

因胸联盟 发表于 2015-1-25 08:59:27

还好,SUN提供了Javabean可以把你的JSP中的 Java代码封装起来,便于调用也便于重用。

灵魂腐蚀 发表于 2015-1-28 10:57:53

另外编写和运行Java程序需要JDK(包括JRE),在sun的官方网站上有下载,thinking in java第三版用的JDK版本是1.4,现在流行的版本1.5(sun称作J2SE 5.0,汗),不过听说Bruce的TIJ第四版国外已经出来了,是专门为J2SE 5.0而写的。

再现理想 发表于 2015-2-5 14:20:27

应用在电视机、电话、闹钟、烤面包机等家用电器的控制和通信。由于这些智能化家电的市场需求没有预期的高,Sun公司放弃了该项计划。随着1990年代互联网的发展

若天明 发表于 2015-2-11 09:10:28

Jive的资料在很多网站上都有,大家可以找来研究一下。相信你读完代码后,会有脱胎换骨的感觉。遗憾的是Jive从2.5以后就不再无条件的开放源代码,同时有licence限制。不过幸好还有中国一流的Java程序员关注它,外国人不开源了,中国人就不能开源吗?这里向大家推荐一个汉化的Jive版本—J道。Jive(J道版)是由中国Java界大名 鼎鼎的banq在Jive 2.1版本基础上改编而成, 全中文,增加了一些实用功能,如贴图,用户头像和用户资料查询等,而且有一个开发团队在不断升级。你可以访问banq的网站

莫相离 发表于 2015-3-2 08:05:16

是一种为 Internet发展的计算机语言

不帅 发表于 2015-3-12 15:19:13

学Java必读的两个开源程序就是Jive和Pet Store.。 Jive是国外一个非常著名的BBS程序,完全开放源码。论坛的设计采用了很多先进的技术,如Cache、用户认证、Filter、XML等,而且论坛完全屏蔽了对数据库的访问,可以很轻易的在不同数据库中移植。论坛还有方便的安装和管理程序,这是我们平时编程时容易忽略的一部份(中国程序员一般只注重编程的技术含量,却完全不考虑用户的感受,这就是我们与国外软件的差距所在)。

精灵巫婆 发表于 2015-3-13 00:08:22

所以现在应用最广泛又最好学的就是J2EE了。 J2EE又包括许多组件,如Jsp,Servlet,JavaBean,EJB,JDBC,JavaMail等。要学习起来可不是一两天的事。那么又该如何学习J2EE呢?当然Java语法得先看一看的,I/O包,Util包,Lang包你都熟悉了吗?然后再从JSP学起。

分手快乐 发表于 2015-3-20 06:33:07

科学超级计算机、移动电话和互联网,同时拥有全球最大的开发者专业社群。
页: [1]
查看完整版本: JAVA教程之Javascript Game