📄 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 + -