?? flygencavans.java
字號:
/*
* FlyGenCavans.java
*
* Created on 2006年4月14日, 下午2:32
*
* To change this template, choose Tools | Options and locate the template under
* the Source Creation and Management node. Right-click the template and choose
* Open. You can then make changes to the template in the Source Editor.
*/
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.*;
import java.util.Random;
import java.io.IOException;
/**
*
* @author Administrator
* GameCanvas implements Runnable
*/
public class FlyGenCavans extends GameCanvas implements Runnable{
/**
*boss召喚出現有坐標(65, 90)
*/
private Random randoms;
/** Creates a new instance of FlyGenCavans */
public static boolean Game_Start=true;//游戲是否結束標示
public static boolean Game_Pause=false;//游戲暫停標志
public static int Screen_W = 176;
public static int Screen_H = 208;
public static int Brick_Height = 36;//背景貼磚的高度
public static int Brick_Width = 36;//背景貼磚的寬度
public static int Game_State;//當前游戲的狀態,即表示要進入那一級菜單
public static int Game_Two_State=1;//進入二級頁面的變量
public static int[] goods_array={//商品的X,Y坐標及價格
14,12,200,
14,36,200,
14,60,100,
14,84,100,
14,108,100,
14,132,100,
83,19,400,
83,48,400,
83,77,400,
93,113,0,
98,125,0
};
public static int[] Boss_Property = {//寬,高,生命值
38,43,3000,
38,44,3000,
38,43,4000,
39,42,4000,
39,51,5000
};
public static int[] hand_array = {//56,46.82
55,65,75,85,95,105
};
public static int Labelling = 1;//關卡
private int Framespeed = 50;//幀速率
private Sprite play_sprite;
private Hero hero_sprite;
private Bullet hero_bullet;
public static int bullet_periods;//游戲背景的移動變量
public static int play_sprite_x;//玩家的X坐標
public static int play_sprite_y;//玩家的Y坐標
private int move_direction =0 ;//玩家的移動方向及進入下一關的延時
private boolean fire_rocket;//判斷玩家是否要射出火箭,及是否能進入下一關
public int[] hero_rocket_zoubiao = new int[2];
private Image exposion;//火箭爆炸效果圖
public static Image gongjian_servant;//弓箭雇傭兵圖片
public static Image daojian_servant;//刀劍雇傭兵圖片
//----------------------------玩家弓箭圖片---------------------------------
public static Image Game_Arrow;
//-------------------------------------------------------------------------
//---------------------------------------------------敵人-------------------
protected Foe[] diaoqb_foe = new Foe[10];//雕騎兵
protected Foe[] gongqb_foe = new Foe[10];//弓騎兵
protected Foe[] qianjz_foe = new Foe[10];//千騎長
protected Foe[] nubb_foe = new Foe[5];//弩步兵
protected Foe[] daojb_foe = new Foe[5];//刀劍兵
protected Foe[] guanmc_foe = new Foe[5];//灌林叢
protected Foe[] block_foe = new Foe[5];//石塊
protected Foe[] shang_foe = new Foe[5];//山崗
protected Foe[] shang_f_foe = new Foe[5];//翻轉的山崗
protected Foe[] obstacle_foe = new Foe[10];//障礙物
protected Foe[] zhangp_foe = new Foe[5];//帳篷敵人
protected Foe[] demos = new Foe[3];//漢民
protected Foe[] lius_foe = new Foe[5];//流沙敵人
protected Foe shop_foe;//商人
protected Sprite[] fire_sprite = new Sprite[3];//火焰
protected Sprite[] chicken_foe = new Sprite[3];//燒雞
protected Foe servant_foe;//應當只要一個雇傭兵就可以了吧?弓箭跟隨者
protected Foe servant_foe2;//
protected Sprite[] flash_sprite = new Sprite[2];//雷電精靈
protected Image[] flash_image = new Image[5];//雷電效果圖片
private Image daojian_img,gongqibing_image;
private Image diaoqb_img,qianjz_img;
private Image chicken_img;//燒雞
private Image nubb_img;//駑步兵
private Image shik_img;//石塊圖片
private Image guanmc_img;//灌木叢圖片
private Image shang_img;//山崗圖片
private Image lius_img;//流沙圖片
private Image zhangp_img;//帳篷圖片
private Image[] flash_back_image = new Image[5];//召喚特效背景
private Image fire_img;//火圖片
private Image shop_npc;//商人圖片
private Image play_head;//玩家的頭像
private long vocation_time;//記錄召喚開始的時間
private long game_all_time;
private int game_each_time_back;//暫存游戲時間變量
private int game_each_time=100000;//每一關的時間
public static int[] game_each_times = {//各關的總游戲時間
10,12,14,15,16
};
public static boolean is_boss_call = false;//boss能否召喚
//--------------------------------------------------------------------------
//-----------------------------------------玩家獎勵圖片------------
public static final int AWARD = 10;
public static Image[] heroaward_array = new Image[AWARD];//獎勵圖片;
//HeroAward
// public static Image[] award_image = new Image[8];
//---------------------------------------------------------------
//----------------------------------場景物品(只是增加畫面美觀)--------------
private Sprite[] huac_sprite = new Sprite[3];//花叢
private Sprite[] kul_sprite = new Sprite[3];//骷髏
private Sprite[] shij_sprite = new Sprite[3];//石介
private Sprite[] xianrz_sprite = new Sprite[3];//仙人掌
private Sprite[] zhal_sprite = new Sprite[3];//柵欄
private Image huac_img;//花叢圖片
private Image kul_img;//骷髏圖片
private Image shij_img;//石介圖片
private Image xianrz_img;//仙人掌圖片
private Image zhal_img;//柵欄圖片
private Image storage_img;//記錄保存圖片
private Image hand_img;//指針圖片
private Image Menu_img;//菜單圖片
//--------------------------------------------------------------------------
protected Foe boss_foe;//Boss
protected Image[] boss_img = new Image[5];//Boss圖片
private int boss_x,boss_y;//暫存boss坐標
private Image goods_image;
public static int move_map_variable = 832;//地圖片移動變量
public Image[] back_map = new Image[5];//地圖背景圖片
private Image demos_image;//漢民圖片
boolean draw_goods;
//------------------------視圖管理------------------------------------------
public LayerManager layermanager;
public static int viewX=0,viewY=0;//當前視圖的坐標
//--------------------------------------------------------------------------
public FlyGenCavans() {
super(false);
layermanager = new LayerManager();
randoms = new Random();
this.draw_goods = false;
this.keyPre= false;
Game_State = 2;
this.Game_Two_State = 1;
this.is_write = 1;
game_each_time_back = this.game_each_time;
}
public void start(){
Create_Object();//生成對象
layermanager.append(hero_sprite);
int[] foe_num0 = {0};
hero_sprite.set_hero_point(20, 100);
hero_sprite.ini_import_property();
Load_Map();
Labelling = 1;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -