⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 m_chick.java

📁 JAKE2用JAVA写的queck2的3D游戏开发引擎
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
            if (damage <= 10)                self.monsterinfo.currentmove = chick_move_pain1;            else if (damage <= 25)                self.monsterinfo.currentmove = chick_move_pain2;            else                self.monsterinfo.currentmove = chick_move_pain3;            return;        }    };    static EntThinkAdapter chick_dead = new EntThinkAdapter() {    	public String getID() { return "chick_dead"; }        public boolean think(edict_t self) {            Math3D.VectorSet(self.mins, -16, -16, 0);            Math3D.VectorSet(self.maxs, 16, 16, 16);            self.movetype = Defines.MOVETYPE_TOSS;            self.svflags |= Defines.SVF_DEADMONSTER;            self.nextthink = 0;            GameBase.gi.linkentity(self);            return true;        }    };    static mframe_t chick_frames_death2[] = new mframe_t[] {            new mframe_t(GameAI.ai_move, -6, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, -1, null),            new mframe_t(GameAI.ai_move, -5, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, -1, null),            new mframe_t(GameAI.ai_move, -2, null),            new mframe_t(GameAI.ai_move, 1, null),            new mframe_t(GameAI.ai_move, 10, null),            new mframe_t(GameAI.ai_move, 2, null),            new mframe_t(GameAI.ai_move, 3, null),            new mframe_t(GameAI.ai_move, 1, null),            new mframe_t(GameAI.ai_move, 2, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 3, null),            new mframe_t(GameAI.ai_move, 3, null),            new mframe_t(GameAI.ai_move, 1, null),            new mframe_t(GameAI.ai_move, -3, null),            new mframe_t(GameAI.ai_move, -5, null),            new mframe_t(GameAI.ai_move, 4, null),            new mframe_t(GameAI.ai_move, 15, null),            new mframe_t(GameAI.ai_move, 14, null),            new mframe_t(GameAI.ai_move, 1, null) };    static mmove_t chick_move_death2 = new mmove_t(FRAME_death201,            FRAME_death223, chick_frames_death2, chick_dead);    static mframe_t chick_frames_death1[] = new mframe_t[] {            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, -7, null),            new mframe_t(GameAI.ai_move, 4, null),            new mframe_t(GameAI.ai_move, 11, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 0, null),            new mframe_t(GameAI.ai_move, 0, null) };    static mmove_t chick_move_death1 = new mmove_t(FRAME_death101,            FRAME_death112, chick_frames_death1, chick_dead);    static EntDieAdapter chick_die = new EntDieAdapter() {    	public String getID() { return "chick_die"; }        public void die(edict_t self, edict_t inflictor, edict_t attacker,                int damage, float[] point) {            int n;            //		   check for gib            if (self.health <= self.gib_health) {                GameBase.gi                        .sound(self, Defines.CHAN_VOICE, GameBase.gi                                .soundindex("misc/udeath.wav"), 1,                                Defines.ATTN_NORM, 0);                for (n = 0; n < 2; n++)                    GameMisc.ThrowGib(self, "models/objects/gibs/bone/tris.md2",                            damage, Defines.GIB_ORGANIC);                for (n = 0; n < 4; n++)                    GameMisc.ThrowGib(self,                            "models/objects/gibs/sm_meat/tris.md2", damage,                            Defines.GIB_ORGANIC);                GameMisc.ThrowHead(self, "models/objects/gibs/head2/tris.md2",                        damage, Defines.GIB_ORGANIC);                self.deadflag = Defines.DEAD_DEAD;                return;            }            if (self.deadflag == Defines.DEAD_DEAD)                return;            //		   regular death            self.deadflag = Defines.DEAD_DEAD;            self.takedamage = Defines.DAMAGE_YES;            n = Lib.rand() % 2;            if (n == 0) {                self.monsterinfo.currentmove = chick_move_death1;                GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_death1, 1,                        Defines.ATTN_NORM, 0);            } else {                self.monsterinfo.currentmove = chick_move_death2;                GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_death2, 1,                        Defines.ATTN_NORM, 0);            }        }    };    static EntThinkAdapter chick_duck_down = new EntThinkAdapter() {    	public String getID() { return "chick_duck_down"; }        public boolean think(edict_t self) {            if ((self.monsterinfo.aiflags & Defines.AI_DUCKED) != 0)                return true;            self.monsterinfo.aiflags |= Defines.AI_DUCKED;            self.maxs[2] -= 32;            self.takedamage = Defines.DAMAGE_YES;            self.monsterinfo.pausetime = GameBase.level.time + 1;            GameBase.gi.linkentity(self);            return true;        }    };    static EntThinkAdapter chick_duck_hold = new EntThinkAdapter() {    	public String getID() { return "chick_duck_hold"; }        public boolean think(edict_t self) {            if (GameBase.level.time >= self.monsterinfo.pausetime)                self.monsterinfo.aiflags &= ~Defines.AI_HOLD_FRAME;            else                self.monsterinfo.aiflags |= Defines.AI_HOLD_FRAME;            return true;        }    };    static EntThinkAdapter chick_duck_up = new EntThinkAdapter() {    	public String getID() { return "chick_duck_up"; }        public boolean think(edict_t self) {            self.monsterinfo.aiflags &= ~Defines.AI_DUCKED;            self.maxs[2] += 32;            self.takedamage = Defines.DAMAGE_AIM;            GameBase.gi.linkentity(self);            return true;        }    };    static mframe_t chick_frames_duck[] = new mframe_t[] {            new mframe_t(GameAI.ai_move, 0, chick_duck_down),            new mframe_t(GameAI.ai_move, 1, null),            new mframe_t(GameAI.ai_move, 4, chick_duck_hold),            new mframe_t(GameAI.ai_move, -4, null),            new mframe_t(GameAI.ai_move, -5, chick_duck_up),            new mframe_t(GameAI.ai_move, 3, null),            new mframe_t(GameAI.ai_move, 1, null) };    static mmove_t chick_move_duck = new mmove_t(FRAME_duck01, FRAME_duck07,            chick_frames_duck, chick_run);    static EntDodgeAdapter chick_dodge = new EntDodgeAdapter() {    	public String getID() { return "chick_dodge"; }        public void dodge(edict_t self, edict_t attacker, float eta) {            if (Lib.random() > 0.25)                return;            if (self.enemy != null)                self.enemy = attacker;            self.monsterinfo.currentmove = chick_move_duck;            return;        }    };    static EntThinkAdapter ChickSlash = new EntThinkAdapter() {    	public String getID() { return "ChickSlash"; }        public boolean think(edict_t self) {            float[] aim = { 0, 0, 0 };            Math3D.VectorSet(aim, Defines.MELEE_DISTANCE, self.mins[0], 10);            GameBase.gi.sound(self, Defines.CHAN_WEAPON, sound_melee_swing, 1,                    Defines.ATTN_NORM, 0);            GameWeapon.fire_hit(self, aim, (10 + (Lib.rand() % 6)), 100);            return true;        }    };    static EntThinkAdapter ChickRocket = new EntThinkAdapter() {    	public String getID() { return "ChickRocket"; }        public boolean think(edict_t self) {            float[] forward = { 0, 0, 0 }, right = { 0, 0, 0 };            float[] start = { 0, 0, 0 };            float[] dir = { 0, 0, 0 };            float[] vec = { 0, 0, 0 };            Math3D.AngleVectors(self.s.angles, forward, right, null);            Math3D.G_ProjectSource(self.s.origin,                    M_Flash.monster_flash_offset[Defines.MZ2_CHICK_ROCKET_1],                    forward, right, start);            Math3D.VectorCopy(self.enemy.s.origin, vec);            vec[2] += self.enemy.viewheight;            Math3D.VectorSubtract(vec, start, dir);            Math3D.VectorNormalize(dir);            Monster.monster_fire_rocket(self, start, dir, 50, 500,                    Defines.MZ2_CHICK_ROCKET_1);            return true;        }    };    static EntThinkAdapter Chick_PreAttack1 = new EntThinkAdapter() {    	public String getID() { return "Chick_PreAttack1"; }        public boolean think(edict_t self) {            GameBase.gi.sound(self, Defines.CHAN_VOICE,                    sound_missile_prelaunch, 1, Defines.ATTN_NORM, 0);            return true;        }    };    static EntThinkAdapter ChickReload = new EntThinkAdapter() {    	public String getID() { return "ChickReload"; }        public boolean think(edict_t self) {            GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_missile_reload,                    1, Defines.ATTN_NORM, 0);            return true;        }    };    static EntThinkAdapter chick_attack1 = new EntThinkAdapter() {    	public String getID() { return "chick_attack1"; }        public boolean think(edict_t self) {            self.monsterinfo.currentmove = chick_move_attack1;            return true;        }    };    static EntThinkAdapter chick_rerocket = new EntThinkAdapter() {    	public String getID() { return "chick_rerocket"; }        public boolean think(edict_t self) {            if (self.enemy.health > 0) {                if (GameUtil.range(self, self.enemy) > Defines.RANGE_MELEE)                    if (GameUtil.visible(self, self.enemy))                        if (Lib.random() <= 0.6) {                            self.monsterinfo.currentmove = chick_move_attack1;                            return true;                        }            }            self.monsterinfo.currentmove = chick_move_end_attack1;            return true;        }    };    static mframe_t chick_frames_start_attack1[] = new mframe_t[] {            new mframe_t(GameAI.ai_charge, 0, Chick_PreAttack1),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, 4, null),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, -3, null),            new mframe_t(GameAI.ai_charge, 3, null),            new mframe_t(GameAI.ai_charge, 5, null),            new mframe_t(GameAI.ai_charge, 7, null),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, 0, chick_attack1) };    static mmove_t chick_move_start_attack1 = new mmove_t(FRAME_attak101,            FRAME_attak113, chick_frames_start_attack1, null);    static mframe_t chick_frames_attack1[] = new mframe_t[] {            new mframe_t(GameAI.ai_charge, 19, ChickRocket),            new mframe_t(GameAI.ai_charge, -6, null),            new mframe_t(GameAI.ai_charge, -5, null),            new mframe_t(GameAI.ai_charge, -2, null),            new mframe_t(GameAI.ai_charge, -7, null),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, 1, null),            new mframe_t(GameAI.ai_charge, 10, ChickReload),            new mframe_t(GameAI.ai_charge, 4, null),            new mframe_t(GameAI.ai_charge, 5, null),            new mframe_t(GameAI.ai_charge, 6, null),            new mframe_t(GameAI.ai_charge, 6, null),            new mframe_t(GameAI.ai_charge, 4, null),            new mframe_t(GameAI.ai_charge, 3, chick_rerocket) };    static mmove_t chick_move_attack1 = new mmove_t(FRAME_attak114,            FRAME_attak127, chick_frames_attack1, null);    static mframe_t chick_frames_end_attack1[] = new mframe_t[] {            new mframe_t(GameAI.ai_charge, -3, null),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, -6, null),            new mframe_t(GameAI.ai_charge, -4, null),            new mframe_t(GameAI.ai_charge, -2, null) };    static mmove_t chick_move_end_attack1 = new mmove_t(FRAME_attak128,            FRAME_attak132, chick_frames_end_attack1, chick_run);    static EntThinkAdapter chick_reslash = new EntThinkAdapter() {    	public String getID() { return "chick_reslash"; }        public boolean think(edict_t self) {            if (self.enemy.health > 0) {                if (GameUtil.range(self, self.enemy) == Defines.RANGE_MELEE)                    if (Lib.random() <= 0.9) {                        self.monsterinfo.currentmove = chick_move_slash;                        return true;                    } else {                        self.monsterinfo.currentmove = chick_move_end_slash;                        return true;                    }            }            self.monsterinfo.currentmove = chick_move_end_slash;            return true;        }    };    static mframe_t chick_frames_slash[] = new mframe_t[] {            new mframe_t(GameAI.ai_charge, 1, null),            new mframe_t(GameAI.ai_charge, 7, ChickSlash),            new mframe_t(GameAI.ai_charge, -7, null),            new mframe_t(GameAI.ai_charge, 1, null),            new mframe_t(GameAI.ai_charge, -1, null),            new mframe_t(GameAI.ai_charge, 1, null),            new mframe_t(GameAI.ai_charge, 0, null),            new mframe_t(GameAI.ai_charge, 1, null),            new mframe_t(GameAI.ai_charge, -2, chick_reslash) };    static mmove_t chick_move_slash = new mmove_t(FRAME_attak204,            FRAME_attak212, chick_frames_slash, null);    static mframe_t chick_frames_end_slash[] = new mframe_t[] {            new mframe_t(GameAI.ai_charge, -6, null),            new mframe_t(GameAI.ai_charge, -1, null),            new mframe_t(GameAI.ai_charge, -6, null),            new mframe_t(GameAI.ai_charge, 0, null) };    static mmove_t chick_move_end_slash = new mmove_t(FRAME_attak213,            FRAME_attak216, chick_frames_end_slash, chick_run);    static EntThinkAdapter chick_slash = new EntThinkAdapter() {    	public String getID() { return "chick_slash"; }        public boolean think(edict_t self) {            self.monsterinfo.currentmove = chick_move_slash;            return true;        }    };    static mframe_t chick_frames_start_slash[] = new mframe_t[] {            new mframe_t(GameAI.ai_charge, 1, null),            new mframe_t(GameAI.ai_charge, 8, null),            new mframe_t(GameAI.ai_charge, 3, null) };    static mmove_t chick_move_start_slash = new mmove_t(FRAME_attak201,            FRAME_attak203, chick_frames_start_slash, chick_slash);    static EntThinkAdapter chick_melee = new EntThinkAdapter() {    	public String getID() { return "chick_melee"; }        public boolean think(edict_t self) {            self.monsterinfo.currentmove = chick_move_start_slash;            return true;        }    };    static EntThinkAdapter chick_attack = new EntThinkAdapter() {    	public String getID() { return "chick_attack"; }        public boolean think(edict_t self) {            self.monsterinfo.currentmove = chick_move_start_attack1;            return true;        }    };    static EntInteractAdapter chick_sight = new EntInteractAdapter() {    	public String getID() { return "chick_sight"; }        public boolean interact(edict_t self, edict_t other) {            GameBase.gi.sound(self, Defines.CHAN_VOICE, sound_sight, 1,                    Defines.ATTN_NORM, 0);            return true;        }    };    /*     * QUAKED monster_chick (1 .5 0) (-16 -16 -24) (16 16 32) Ambush     * Trigger_Spawn Sight     */    public static void SP_monster_chick(edict_t self) {        if (GameBase.deathmatch.value != 0) {            GameUtil.G_FreeEdict(self);            return;        }        sound_missile_prelaunch = GameBase.gi.soundindex("chick/chkatck1.wav");        sound_missile_launch = GameBase.gi.soundindex("chick/chkatck2.wav");        sound_melee_swing = GameBase.gi.soundindex("chick/chkatck3.wav");        sound_melee_hit = GameBase.gi.soundindex("chick/chkatck4.wav");        sound_missile_reload = GameBase.gi.soundindex("chick/chkatck5.wav");        sound_death1 = GameBase.gi.soundindex("chick/chkdeth1.wav");        sound_death2 = GameBase.gi.soundindex("chick/chkdeth2.wav");        sound_fall_down = GameBase.gi.soundindex("chick/chkfall1.wav");        sound_idle1 = GameBase.gi.soundindex("chick/chkidle1.wav");        sound_idle2 = GameBase.gi.soundindex("chick/chkidle2.wav");        sound_pain1 = GameBase.gi.soundindex("chick/chkpain1.wav");        sound_pain2 = GameBase.gi.soundindex("chick/chkpain2.wav");        sound_pain3 = GameBase.gi.soundindex("chick/chkpain3.wav");        sound_sight = GameBase.gi.soundindex("chick/chksght1.wav");        sound_search = GameBase.gi.soundindex("chick/chksrch1.wav");        self.movetype = Defines.MOVETYPE_STEP;        self.solid = Defines.SOLID_BBOX;        self.s.modelindex = GameBase.gi                .modelindex("models/monsters/bitch/tris.md2");        Math3D.VectorSet(self.mins, -16, -16, 0);        Math3D.VectorSet(self.maxs, 16, 16, 56);        self.health = 175;        self.gib_health = -70;        self.mass = 200;        self.pain = chick_pain;        self.die = chick_die;        self.monsterinfo.stand = chick_stand;        self.monsterinfo.walk = chick_walk;        self.monsterinfo.run = chick_run;        self.monsterinfo.dodge = chick_dodge;        self.monsterinfo.attack = chick_attack;        self.monsterinfo.melee = chick_melee;        self.monsterinfo.sight = chick_sight;        GameBase.gi.linkentity(self);        self.monsterinfo.currentmove = chick_move_stand;        self.monsterinfo.scale = MODEL_SCALE;        GameAI.walkmonster_start.think(self);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -