Name | Author | Game Mode | Rating | |||||
---|---|---|---|---|---|---|---|---|
Arcane Weapons | PurpleJazz | Mutator | 10 |
#pragma name "Nail Gun"
#pragma require "Nail.j2a"
#pragma require "f_ar3.wav"
bool gameIsActive() {
return jjGameState == GAME::STARTED || jjGameState == GAME::OVERTIME;
}
void onLevelLoad() {
jjAnimSets[ANIM::CUSTOM[25]].load(0, "Nail.j2a");
jjAnimations[jjAnimSets[ANIM::AMMO] + 49] = jjAnimations[jjAnimSets[ANIM::CUSTOM[25]] + 4];
jjAnimations[jjAnimSets[ANIM::AMMO] + 48] = jjAnimations[jjAnimSets[ANIM::CUSTOM[25]] + 5];
jjSampleLoad(SOUND::P2_CRUNCH, "f_ar3.wav");
jjObjectPresets[OBJECT::RFBULLET].behavior = jjObjectPresets[OBJECT::RFBULLETPU].behavior = Nailgun();
jjObjectPresets[OBJECT::RFBULLET].var[6] = 16;
jjObjectPresets[OBJECT::RFBULLET].counterEnd = 60;
jjObjectPresets[OBJECT::RFBULLET].killAnim = jjObjectPresets[OBJECT::BLASTERBULLET].killAnim;
jjObjectPresets[OBJECT::RFBULLET].special = jjObjectPresets[OBJECT::RFBULLET].determineCurAnim(ANIM::CUSTOM[25], 0);
jjObjectPresets[OBJECT::RFBULLETPU].var[6] = 8 + 16;
jjObjectPresets[OBJECT::RFBULLETPU].counterEnd = 55;
jjObjectPresets[OBJECT::RFBULLETPU].killAnim = jjObjectPresets[OBJECT::BLASTERBULLET].killAnim;
jjObjectPresets[OBJECT::RFBULLETPU].special = jjObjectPresets[OBJECT::RFBULLETPU].determineCurAnim(ANIM::CUSTOM[25], 1);
jjObjectPresets[OBJECT::RFBULLET].lightType = jjObjectPresets[OBJECT::RFBULLETPU].lightType = LIGHT::POINT;
jjObjectPresets[OBJECT::RFAMMO3].lightType = LIGHT::POINT;
jjObjectPresets[OBJECT::RFAMMO15].determineCurAnim(ANIM::CUSTOM[25], 2);
jjObjectPresets[OBJECT::RFAMMO15].determineCurFrame();
jjObjectPresets[OBJECT::RFPOWERUP].determineCurAnim(ANIM::CUSTOM[25], 3);
jjObjectPresets[OBJECT::RFPOWERUP].determineCurFrame();
jjWeapons[WEAPON::RF].spread = SPREAD::NORMAL;
jjWeapons[WEAPON::RF].style = WEAPON::NORMAL;
jjWeapons[WEAPON::RF].defaultSample = false;
jjANIMATION@ anim = jjAnimations[jjAnimSets[ANIM::AMMO] + 71];
for (uint i = 0; i < anim.frameCount; ++i) {
jjANIMFRAME@ frame = jjAnimFrames[anim + i];
jjPIXELMAP sprite(frame);
for (uint x = 0; x < sprite.width; ++x)
for (uint y = 0; y < sprite.height; ++y)
if (sprite[x,y] != 0) sprite[x,y] = 0;
sprite.save(frame);
}
}
class Nailgun : jjBEHAVIORINTERFACE {
void onBehave(jjOBJ@ obj) {
obj.behave(obj.state == STATE::EXPLODE? BEHAVIOR::BULLET : BEHAVIOR::RFBULLET, obj.state == STATE::EXPLODE? true:false);
jjPLAYER@ creator = jjPlayers[obj.creatorID];
obj.var[0] = int(atan2(-obj.ySpeed, obj.xSpeed) * (512.f * 0.318309886142228f));
obj.xAcc = (obj.eventID == OBJECT::RFBULLETPU? 0.4:0.35) * obj.direction;
if (obj.ySpeed < 0 && obj.direction == 0 && obj.xSpeed == 0) obj.yAcc = -0.5;
if (obj.state != STATE::EXPLODE) {
if (obj.counter == 1 && creator.isLocal) {
jjSample(creator.xPos, creator.yPos, SOUND::P2_CRUNCH, 48, obj.eventID == OBJECT::RFBULLETPU? 19000:17500);
obj.var[2] = 0;
obj.playerHandling = HANDLING::PLAYERBULLET;
}
jjDrawRotatedSprite(obj.xPos, obj.yPos, ANIM::CUSTOM[25], obj.eventID == OBJECT::RFBULLETPU? 1:0, 0, obj.var[0], 1, 1, SPRITE::NORMAL);
float dx = jjLocalPlayers[0].xPos - obj.xPos, dy = jjLocalPlayers[0].yPos - obj.yPos;
if ((dx * dx + dy * dy < 64 * 24) && !creator.isLocal && jjLocalPlayers[0].blink == 0 && (jjLocalPlayers[0].team != creator.team || jjFriendlyFire || jjGameMode != GAME::CTF) && gameIsActive()) {
jjLocalPlayers[0].xPos = obj.xPos - (24 * obj.direction);
jjLocalPlayers[0].ySpeed = obj.ySpeed;
}
if (jjMaskedPixel(int(obj.xPos + obj.xSpeed + obj.var[7] / 65536.f), int(obj.yPos))) {
obj.xSpeed = 0;
obj.var[7] = 0;
obj.playerHandling = HANDLING::PARTICLE;
obj.bePlatform(obj.xPos, obj.yPos, 32, 8);
if (obj.var[2] == 0) {
jjSample(obj.xPos, obj.yPos, SOUND::COMMON_METALHIT, 0, 0);
obj.counter = 1;
if (obj.eventID == OBJECT::RFBULLETPU) obj.counterEnd = 90;
obj.var[2] = 1;
}
}
else if (jjMaskedPixel(int(obj.xPos), int(obj.yPos + obj.ySpeed))) {
obj.ySpeed = 0;
obj.playerHandling = HANDLING::PARTICLE;
if (obj.var[2] == 0) {
jjSample(obj.xPos, obj.yPos, SOUND::COMMON_METALHIT, 0, 0);
obj.counter = 1;
if (obj.eventID == OBJECT::RFBULLETPU) obj.counterEnd = 90;
obj.var[2] = 1;
}
}
} else {
obj.clearPlatform();
obj.var[2] = 0;
obj.counterEnd = obj.eventID == OBJECT::RFBULLETPU? 55:60;
}
}
}
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.