2.0
24 Feb 2015 21:39
void onLevelLoad() { //formalities
jjObjectPresets[OBJECT::FIREBALLBULLET].special = jjObjectPresets[OBJECT::FIREBALLBULLET].determineCurAnim(ANIM::AMMO, 8);
jjObjectPresets[OBJECT::FIREBALLBULLET].behavior = BubbleGun;
jjObjectPresets[OBJECT::FIREBALLBULLET].xSpeed = 1.25;
jjObjectPresets[OBJECT::FIREBALLBULLET].ySpeed = 0;
jjObjectPresets[OBJECT::FIREBALLBULLET].counterEnd = 105;
jjObjectPresets[OBJECT::FIREBALLBULLETPU].special = jjObjectPresets[OBJECT::FIREBALLBULLETPU].determineCurAnim(ANIM::AMMO, 8);
jjObjectPresets[OBJECT::FIREBALLBULLETPU].behavior = BubbleGunPU;
jjObjectPresets[OBJECT::FIREBALLBULLETPU].xSpeed = 1.5;
jjObjectPresets[OBJECT::FIREBALLBULLETPU].ySpeed = 0;
jjObjectPresets[OBJECT::FIREBALLBULLETPU].counterEnd = 105;
jjObjectPresets[OBJECT::GUN8AMMO3].determineCurAnim(ANIM::AMMO, 8, true);
jjObjectPresets[OBJECT::GUN8POWERUP].behavior = BubbleMonitor; //display the gun8 powerup as a bubble powerup
}
void onLevelBegin() {
if (jjIsServer || jjGameMode == GAME::Mode::SP) jjChat("/fireball on"); //fireball needs to be enabled for this weapon to work
}
void BubbleGun(jjOBJ@ bubble) {
if (bubble.state == STATE::START) {
bubble.state = STATE::FLY;
if (jjSoundEnabled) jjSample(bubble.xPos, bubble.yPos, SOUND::COMMON_PLOP2, 0, 0);
}
bubble.behave(BEHAVIOR::WATERSHIELDBULLET);
if (jjMaskedPixel(bubble.xPos + bubble.xSpeed, bubble.yPos) || jjMaskedPixel(bubble.xPos - bubble.xSpeed, bubble.yPos) || jjMaskedPixel(bubble.xPos, bubble.yPos + bubble.ySpeed) || jjMaskedPixel(bubble.xPos, bubble.yPos - bubble.ySpeed)) {
if (jjSoundEnabled) jjSample(bubble.xPos, bubble.yPos, SOUND::P2_SPLOUT, 0, 0);
}
bubble.killAnim = jjObjectPresets[OBJECT::WATERSHIELDBULLET].killAnim;
bubble.determineCurFrame();
bubble.animSpeed = 1; //for SP
bubble.var[6] = 0; //for MP
}
void BubbleGunPU(jjOBJ@ bubble) {
if (bubble.state == STATE::START) {
bubble.state = STATE::FLY;
if (jjSoundEnabled) jjSample(bubble.xPos, bubble.yPos, SOUND::COMMON_PLOP2, 0, 0);
}
bubble.behave(BEHAVIOR::WATERSHIELDBULLET);
if (bubble.state == STATE::FLY && bubble.counter > 0) { //controls on the arc of the bullet
switch (bubble.direction) {
case 0: bubble.ySpeed = bubble.ySpeed - 0.08; break;
case 1: bubble.xSpeed = bubble.xSpeed - 0.1; bubble.ySpeed = bubble.ySpeed - 0.08; break;
case -1: bubble.xSpeed = bubble.xSpeed + 0.1; bubble.ySpeed = bubble.ySpeed - 0.08; break;
}
}
if (jjMaskedPixel(bubble.xPos + bubble.xSpeed, bubble.yPos) || jjMaskedPixel(bubble.xPos - bubble.xSpeed, bubble.yPos) || jjMaskedPixel(bubble.xPos, bubble.yPos + bubble.ySpeed) || jjMaskedPixel(bubble.xPos, bubble.yPos - bubble.ySpeed)) {
if (jjSoundEnabled) jjSample(bubble.xPos, bubble.yPos, SOUND::P2_SPLOUT, 0, 0);
}
bubble.killAnim = jjObjectPresets[OBJECT::WATERSHIELDBULLET].killAnim;
jjDrawSpriteFromCurFrame(bubble.xPos, bubble.yPos, bubble.curFrame, bubble.direction, SPRITE::NEONGLOW, 2);
bubble.determineCurFrame();
bubble.animSpeed = 2; //for SP
bubble.var[6] = 8; //for MP
}
void BubbleMonitor(jjOBJ@ obj) {
obj.behave(BEHAVIOR::MONITOR);
if (obj.justHit == 0) {
jjDrawSprite(obj.xPos+7, obj.yPos-1, ANIM::AMMO, 8, 3); //cheeky!
}
}
bool onDrawAmmo(jjPLAYER@ play, jjCANVAS@ canvas) { //displays the bubble sprite on the gun icon
if (play.currWeapon == WEAPON::GUN8 && !play.noFire) {
canvas.drawSprite(
jjSubscreenWidth - 88,
jjSubscreenHeight - 14,
ANIM::AMMO, 8, play.powerup[WEAPON::GUN8] == true? 4:3,
SPRITE::NORMAL
);
canvas.drawString(
jjSubscreenWidth - 80,
jjSubscreenHeight - 14,
"x" + play.ammo[WEAPON::GUN8],
STRING::MEDIUM,
STRING::NORMAL
);
return true;
}
else return false;
}
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.