?? flygencavans.java
字號(hào):
Thread t = new Thread(this);
t.start();
}
private boolean is_create=false;
private int p_status;//幫助字體上下移動(dòng)的變量
int fontHeight;
long starttime;//游戲一個(gè)循環(huán)的開(kāi)始時(shí)間
long continue_time;//
long wait_time;//數(shù)據(jù)載入
public static int is_write;//是否要保存記錄(用到Switch里面第三層)
String play_name;//玩家的名稱(chēng)
private char[] playerNameChar=new char[5];//玩家字符串
private int i_status=0,j_status=0;
public void run(){
Graphics gg = getGraphics();
int[] tem_num1 = {0};
gg.setFont(Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN,Font.SIZE_MEDIUM));
font = gg.getFont();
try{
while(Game_Start){
starttime = System.currentTimeMillis();
//-------------------------------------程序循環(huán)
this.layermanager.setViewWindow(viewX, viewY, this.Screen_W, this.Screen_H);
switch(Game_State){
case 1://進(jìn)入菜單選項(xiàng)
gg.drawString("進(jìn)入菜單選項(xiàng)~~~~~", 0, 20, Graphics.TOP|Graphics.LEFT);
// gg.setFont(Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN,Font.SIZE_MEDIUM));
// gg.setColor(212,212,141);
if (keyPre && v_GameCode==Canvas.UP){
if (--i_status<0)
i_status++;
}else if(keyPre && v_GameCode==Canvas.DOWN){
if(++i_status>3)
i_status=3;
}else if(keyPre && v_GameCode==Canvas.FIRE){
switch(i_status){//j_status 控制字符的位置
case 0://開(kāi)始新游戲
this.Game_State = 2;
i_status = 0;
Create_Object();//生成對(duì)象
layermanager.append(hero_sprite);
int[] foe_num0 = {0};
hero_sprite.set_hero_point(20, 100);
hero_sprite.ini_import_property();
Load_Map();
Labelling = 1;
break;
case 1://排行榜
this.Game_State = 3;
i_status = 0;
break;
case 2://游戲幫助
this.Game_State = 4;
i_status = 0;
break;
case 3://退出游戲
this.Game_State = 5;
i_status = 0;
break;
}
}
break;
case 2://進(jìn)入新游戲;
if(!Game_Pause){//暫停//游戲進(jìn)行時(shí)
switch(Game_Two_State){//在這里,1表示游戲正常進(jìn)行~~。2表示Boss召喚.3表示游戲已經(jīng)通關(guān)要顯示的內(nèi)容.4表示玩家是否要繼續(xù)游戲.5表示游戲結(jié)束
case 1://游戲進(jìn)行
play_sprite_x = hero_sprite.getX();
play_sprite_y = hero_sprite.getY();
if(System.currentTimeMillis() - game_all_time >=1000){
//到1秒鐘記時(shí)一次
game_each_time--;
game_all_time = System.currentTimeMillis();
}
//--------
int[] tem_foe_sort = display_map();//{-1,0,0};-1表示沒(méi)有怪物信息
if(tem_foe_sort[0]!=-1){
switch(tem_foe_sort[0]){
case 1://雕騎兵
for(int i =0;i<10;i++){
if(!diaoqb_foe[i].isVisible() && !is_create){
diaoqb_foe[i].set_foe_point(tem_foe_sort[1],0);//tem_foe_sort[2]
diaoqb_foe[i].ini_property();
diaoqb_foe[i].set_Award();
is_create = true;
}
}
break;
case 2://弓騎兵
for(int i =0;i<10;i++){
if(!gongqb_foe[i].isVisible() && !is_create){
gongqb_foe[i].set_foe_point(tem_foe_sort[1], 0);
gongqb_foe[i].ini_property();
gongqb_foe[i].set_Award();
is_create = true;
}
}
break;
case 3://千騎長(zhǎng)
for(int i=0;i<10;i++){
if(!qianjz_foe[i].isVisible() && !is_create){
qianjz_foe[i].set_foe_point(tem_foe_sort[1], 0);
qianjz_foe[i].ini_property();
qianjz_foe[i].set_Award();
is_create = true;
}
}
break;
case 4://弩步兵
for(int i=0;i<5;i++){
if(!nubb_foe[i].isVisible() && !is_create){
nubb_foe[i].set_foe_point(tem_foe_sort[1], 0);
nubb_foe[i].ini_property();
nubb_foe[i].set_Award();
is_create = true;
}
}
break;
case 5://刀劍兵
for(int i =0;i<5;i++){
if(!daojb_foe[i].isVisible() && !is_create){
daojb_foe[i].set_foe_point(tem_foe_sort[1], 0);
daojb_foe[i].ini_property();
daojb_foe[i].set_Award();
//System.out.println("當(dāng)前生成的獎(jiǎng)勵(lì)為:"+daojb_foe[i].foe_property[14]);
is_create = true;
}
}
break;
case 6://Boss
System.out.println("Boss已經(jīng)生成~~~~~~~~~");
boss_foe.setImage(boss_img[Labelling-1], Boss_Property[(Labelling-1)*3], Boss_Property[(Labelling-1)*3+1]);
this.boss_foe.set_foe_point(tem_foe_sort[1], 0);
this.boss_foe.ini_property();
boss_foe.foe_property[2] = Boss_Property[(Labelling-1)*3+2];//賦生命值
p_status = Boss_Property[(Labelling-1)*3+2];
System.out.println("Boss的生命值為:"+boss_foe.foe_property[2]);
break;
case 7://石頭
for(int i=0;i<5;i++){
if(!this.block_foe[i].isVisible() && !is_create){
block_foe[i].set_foe_point(tem_foe_sort[1], 0);
block_foe[i].ini_property();
block_foe[i].set_Award();
is_create = true;
block_foe[i].foe_property[4] = 0;
block_foe[i].foe_property[5] = 1;
block_foe[i].foe_property[3] = 0;
}
}
break;
case 8://灌木叢
for(int i=0;i<5;i++){
if(!guanmc_foe[i].isVisible() && !is_create){
guanmc_foe[i].set_foe_point(tem_foe_sort[1], -30);
guanmc_foe[i].ini_property();
is_create = true;
guanmc_foe[i].foe_property[4] = 0;
guanmc_foe[i].foe_property[5] = 1;
guanmc_foe[i].foe_property[3] = 0;
}
}
break;
case 9://流沙
for(int i=0;i<5;i++){
if(!this.lius_foe[i].isVisible() && !is_create){
lius_foe[i].set_foe_point(tem_foe_sort[1], 0);
lius_foe[i].ini_property();
is_create = true;
lius_foe[i].foe_property[4] = 0;
lius_foe[i].foe_property[5] = 1;
lius_foe[i].foe_property[3] = 0;
}
}
break;
case 10://山崗
for(int i=0;i<5;i++){
if(!shang_foe[i].isVisible() && !is_create){
shang_foe[i].set_foe_point(tem_foe_sort[1], -113);
shang_foe[i].ini_property();
is_create = true;
shang_foe[i].foe_property[4] = 0;
shang_foe[i].foe_property[5] = 1;
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -