Name | Author | Game Mode | Rating | |||||
---|---|---|---|---|---|---|---|---|
Weapon Mega | Violet CLM | Mutator | 8.7 |
#pragma name "Weapon Mega: Burrower"
#pragma require "weaponMega2.mut"
#include "weaponMega.asc"
bool LoadWeaponMega2() {
if (!SafeToReplaceWeapon(WEAPON::BOUNCER))
return false;
jjWeapons[WEAPON::BOUNCER].defaultSample = false;
jjWeapons[WEAPON::BOUNCER].style = WEAPON::MISSILE;
//if (jjAnimSets[ANIM::BUBBA] == 0) jjAnimSets[ANIM::BUBBA].load();
Preset1.behavior = ApplyBurrower;
Preset2.behavior = ApplyBurrower;
Preset1.determineCurAnim(AnimSet, 0);
Preset2.determineCurAnim(AnimSet, 1);
Preset1.special = Preset2.special = 0;
Preset1.yAcc = Preset2.yAcc = 0.125f;
return true;
}
const bool WeaponMega2Loaded = LoadWeaponMega2();
void ApplyBurrower(jjOBJ@ obj) { obj.behavior = Burrower(obj); obj.behave(); }
class Burrower : WeaponMega {
bool alreadyStartedDigging = false;
Burrower(jjOBJ@ objectOfAttachment) {
@obj = @objectOfAttachment;
obj.yAcc = abs(obj.yAcc);
obj.state = STATE::FLY;
obj.age = obj.objectID;
jjSample(obj.xPos, obj.yPos, SOUND::COMMON_LAND);
}
bool inGround() const {
return jjMaskedPixel(int(obj.xPos), int(obj.yPos) - 8);
}
void onBehave(jjOBJ@) override {
obj.frameID = jjGameTicks >> 2;
obj.determineCurFrame();
if (obj.state == STATE::EXPLODE)
die();
else if (!alreadyStartedDigging) {
obj.xPos += obj.xSpeed + obj.var[7] / 65536.f;
obj.yPos += (obj.ySpeed += obj.yAcc);
if (obj.var[7] > 0x100000)
obj.var[7] = obj.var[7] - 0x80000;
else if (obj.var[7] < -0x100000)
obj.var[7] = obj.var[7] + 0x80000;
if (obj.xPos < 0 || obj.xPos >= LevelRight || obj.yPos >= LevelBottom)
obj.delete();
else if (alreadyStartedDigging = inGround()) {
if (int(obj.xSpeed) == 0)
die();
else if (!isPowerup())
obj.xSpeed *= 0.6667;
}
} else {
//obj.ySpeed = 0;
obj.xPos += obj.xSpeed;
if (obj.xPos < 0 || obj.xPos >= LevelRight || !inGround() || nearEnemy())
die();
else {
obj.age = jjSampleLooped(obj.xPos, obj.yPos, SOUND::BUBBA_TORNADOATTACK2, obj.age, 63, 200000);
if (jjGameTicks & 3 == 0) {
jjOBJ@ rock = jjObjects[jjAddObject(OBJECT::SHARD, obj.xPos, obj.yPos - 14, obj.objectID, CREATOR::OBJECT, BEHAVIOR::INACTIVE)];
rock.curAnim = obj.curAnim + (isPowerup() ? 1 : 2) + (jjRandom() & 3);
rock.lightType = LIGHT::POINT;
rock.light = 1;
rock.behavior = BEHAVIOR::SHARD;
}
}
}
}
void onDraw(jjOBJ@) override {
if (!alreadyStartedDigging)
WeaponMega::onDraw(obj);
else
jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, getBulletDirection(), SPRITE::NORMAL, 0, 5); //behind walls
}
bool nearEnemy() const {
return (getNearestEnemy(40) >= 0);
}
void die() {
obj.direction = getBulletDirection();
obj.particlePixelExplosion(2);
obj.yPos -= 16; //make it easier to hit people
blast(jjAnimSets[ANIM::AMMO] + 3);
obj.yPos += 16; //for aesthetic purposes
}
}
Jazz2Online © 1999-INFINITY (Site Credits). We have a Privacy Policy. Jazz Jackrabbit, Jazz Jackrabbit 2, Jazz Jackrabbit Advance and all related trademarks and media are ™ and © Epic Games. Lori Jackrabbit is © Dean Dodrill. J2O development powered by Loops of Fury and Chemical Beats.
Eat your lima beans, Johnny.