Name | Author | Game Mode | Rating | |||||
---|---|---|---|---|---|---|---|---|
Miscellaneous stuff | Violet CLM | Multiple | N/A |
void onLevelLoad() {
jjObjectPresets[OBJECT::ICEBULLET].special = jjObjectPresets[OBJECT::ICEBULLET].determineCurAnim(ANIM::AMMO, 81);
jjObjectPresets[OBJECT::ICEBULLET].frameID = 3;
jjObjectPresets[OBJECT::ICEBULLET].determineCurFrame();
jjObjectPresets[OBJECT::ICEBULLET].counterEnd = 0;
jjObjectPresets[OBJECT::ICEBULLET].behavior = BallBullet;
jjObjectPresets[OBJECT::ICEBULLET].xSpeed = 2;
jjObjectPresets[OBJECT::ICEBULLET].ySpeed = -3;
jjObjectPresets[OBJECT::ICEBULLET].yAcc = 0.2;
//jjObjectPresets[OBJECT::ICEBULLET].var[6] = jjObjectPresets[OBJECT::ICEBULLET].var[6] | 16; //pass through players
jjObjectPresets[AREA::WARPTARGET].behavior = BEHAVIOR::BEES; //be an object, but not much of one
jjObjectPresets[AREA::WARPTARGET].playerHandling = HANDLING::SPECIALDONE;
jjObjectPresets[AREA::WARPTARGET].bulletHandling = HANDLING::IGNOREBULLET;
jjObjectPresets[AREA::WARPTARGET].isFreezable = false;
jjObjectPresets[AREA::WARPTARGET].light = 16;
jjObjectPresets[OBJECT::TNT].behavior = Bomb;
jjObjectPresets[OBJECT::ELECTROBULLETPU].special = jjObjectPresets[OBJECT::ELECTROBULLETPU].determineCurAnim(ANIM::FLAG, 1); //large sprite
jjObjectPresets[OBJECT::ELECTROBULLETPU].frameID = 0;
jjObjectPresets[OBJECT::ELECTROBULLETPU].determineCurFrame();
jjObjectPresets[OBJECT::ELECTROBULLETPU].behavior = LavaFlow;
jjObjectPresets[OBJECT::ELECTROBULLETPU].xSpeed = 8;
jjObjectPresets[OBJECT::ELECTROBULLETPU].lightType = LIGHT::BRIGHT;
jjObjectPresets[OBJECT::ELECTROBULLETPU].light = 15;
jjObjectPresets[OBJECT::ELECTROBULLETPU].eventID = OBJECT::TOASTERBULLETPU; //do double damage regardless of whether /strongpowerups is on
jjObjectPresets[OBJECT::ELECTROBULLETPU].isBlastable = false; //that would just be awkward
jjObjectPresets[OBJECT::TNTDESTRUCTSCENERY].scriptedCollisions = true;
jjObjectPresets[OBJECT::TNTDESTRUCTSCENERY].triggersTNT = false;
jjObjectPresets[OBJECT::APPLE].behavior = ChainPlatform;
jjObjectPresets[OBJECT::APPLE].playerHandling = HANDLING::SPECIALDONE;
jjObjectPresets[OBJECT::APPLE].determineCurAnim(ANIM::MENU, (jjIsTSF) ? 8 : 7); //"JAZZ", 128 pixels wide
jjObjectPresets[OBJECT::APPLE].frameID = 0;
jjObjectPresets[OBJECT::APPLE].determineCurFrame();
jjObjectPresets[OBJECT::ICECREAM].behavior = Alarm;
jjObjectPresets[OBJECT::ICECREAM].playerHandling = HANDLING::SPECIALDONE;
jjObjectPresets[OBJECT::ICECREAM].determineCurAnim(ANIM::AMMO, 81);
jjObjectPresets[OBJECT::ICECREAM].frameID = 0;
jjObjectPresets[OBJECT::ICECREAM].light = 10;
jjObjectPresets[OBJECT::ICECREAM].determineCurFrame();
jjWeapons[WEAPON::TNT].maximum = 10;
}
void BallBullet(jjOBJ@ obj) {
if (obj.state == STATE::START) {
obj.state = STATE::FLY;
obj.xSpeed = obj.xSpeed + obj.var[7] / 65536.f;
} else if (obj.state == STATE::EXPLODE) {
obj.counterEnd = 99;
}
obj.xSpeed = obj.xSpeed + obj.xAcc;
obj.ySpeed = obj.ySpeed + obj.yAcc;
if (jjMaskedPixel(obj.xPos + obj.xSpeed, obj.yPos)) {
obj.xSpeed = -obj.xSpeed;
++obj.counterEnd;
} else if (jjMaskedPixel(obj.xPos, obj.yPos + obj.ySpeed)) {
obj.ySpeed = -obj.ySpeed;
++obj.counterEnd;
}
if (obj.counterEnd > 4) {
obj.state = STATE::EXPLODE;
obj.behavior = BEHAVIOR::RFBULLET;
obj.frameID = 0;
obj.counter = 0;
return;
}
obj.xPos = obj.xPos + obj.xSpeed;
obj.yPos = obj.yPos + obj.ySpeed;
if (++obj.counter >= 4) {
obj.counter = 0;
//uint rand = jjRandom();
//if ((rand & 3) == 0) {
jjPARTICLE@ part = jjAddParticle(PARTICLE::ICETRAIL);
if (part !is null) {
part.xPos = obj.xPos;
part.yPos = obj.yPos;
}
//}
}
jjDrawTile(obj.xPos - 16, obj.yPos - 16, 0 | TILE::ANIMATED);
}
void onPlayerInput(jjPLAYER@ play) {
if (play.frozen > 0)
play.keyFire = false; //>)
play.ammo[WEAPON::GUN9] = 0; //just in case you get some with /ready
}
void setAllAdjacentAlarms(jjOBJ@ obj, int adjust) {
for (int i = jjObjectCount - 1; i >= 1; --i) {
jjOBJ@ obj2 = jjObjects[i];
if (obj2.behavior == Alarm && (abs(obj2.xOrg - obj.xOrg) < 96 || abs(obj2.yOrg - obj.yOrg) < 96)) {
obj2.counter += adjust;
}
}
}
void Bomb(jjOBJ@ obj) {
if (obj.state == STATE::START) {
for (int i = jjObjectCount - 1; i >= 1; --i) {
jjOBJ@ obj2 = jjObjects[i];
if (obj2.isActive && abs(obj2.xPos - obj.xPos) < 80 && abs(obj2.yPos - obj.yPos) < 80) {
if (obj2.eventID == AREA::WARPTARGET) {
obj.xOrg = obj2.xOrg;
obj.yOrg = obj2.yOrg;
obj.state = STATE::HIDE;
obj.isFreezable = false;
obj.bulletHandling = HANDLING::IGNOREBULLET;
} else if (obj2.eventID == OBJECT::TNT && @obj != @obj2 && obj2.behavior == Bomb) { //another TNT in the same area??
obj.delete();
return;
}
}
}
if (obj.state == STATE::START) { //no target found
obj.behavior = BEHAVIOR::TNT;
obj.behave();
}
} else if (obj.state == STATE::HIDE) {
int atTarget = 0;
if (abs(obj.xOrg - obj.xPos) > 4) {
if (obj.xOrg > obj.xPos) obj.xPos = obj.xPos + 2;
else obj.xPos = obj.xPos - 2;
} else ++atTarget;
if (abs(obj.yOrg - obj.yPos) > 4) {
if (obj.yOrg > obj.yPos) obj.yPos = obj.yPos + 2;
else obj.yPos = obj.yPos - 2;
} else ++atTarget;
if (atTarget == 2) {
obj.state = STATE::DELAYEDSTART;
obj.lightType = LIGHT::RING2;
obj.counter = 5*70 + 20;
obj.xPos = int(obj.xPos) / 32 * 32 + 16; //position more carefully
obj.yPos = int(obj.yPos) / 32 * 32 + 16;
setAllAdjacentAlarms(obj, 1);
}
obj.draw();
} else if (obj.state == STATE::DELAYEDSTART) {
if (--obj.counter % 70 == 0) {
jjPARTICLE@ part = jjAddParticle(PARTICLE::STRING);
if (part !is null) {
part.xPos = obj.xPos;
part.yPos = obj.yPos;
part.string.text = "||||" + (obj.counter / 70);
part.ySpeed = -0.1;
}
if (obj.counter == 0) {
obj.state = STATE::FIRE;
}
}
obj.light = obj.counter >> 1; //ring closes in on self-readying explosive
obj.draw();
} else if (obj.state == STATE::FIRE) {
jjPLAYER@ play = jjPlayers[obj.creator];
if (obj.counter++ % 10 == 0 && play.isLocal) {
float oldX = play.xPos, oldY = play.yPos;
play.xPos = obj.xPos; play.yPos = obj.yPos;
play.powerup[WEAPON::GUN9] = true;
for (float i = 0; i < 2; i += 0.5) {
play.fireBullet(WEAPON::GUN9, false, false, i * 3.14159265359);
}
play.xPos = oldX; play.yPos = oldY;
}
if (obj.counter >= 160) {
setAllAdjacentAlarms(obj, -1); //still a little premature, since the lava will still be flowing, but oh well
obj.delete();
}
}
}
void onDrawLayer4(jjPLAYER@ play, jjCANVAS@ screen) {
for (int i = jjObjectCount - 1; i >= 1; --i) {
jjOBJ@ obj = jjObjects[i];
if (obj.isActive) {
if (obj.eventID == AREA::WARPTARGET)
obj.lightType = (play.currWeapon == WEAPON::TNT) ? LIGHT::LASER : LIGHT::NONE; //by placing this search in an onDraw, the lightType can be drawn differently to different local subscreens
else if (obj.eventID == OBJECT::TNTDESTRUCTSCENERY)
obj.isFreezable = false; //behavior resets this sometimes :(
}
}
}
void LavaFlow(jjOBJ@ obj) {
if (obj.state == STATE::START) {
for (int i = jjObjectCount - 1; i >= 1; --i) {
jjOBJ@ obj2 = jjObjects[i];
if (obj2.isActive && obj2.eventID == AREA::WARPTARGET && abs(obj2.xPos - obj.xPos) < 80 && abs(obj2.yPos - obj.yPos) < 80) {
obj.xPos = obj2.xPos;
obj.yPos = obj2.yPos + 48; //adjust for hotspot
obj.state = STATE::FLY;
return;
}
}
obj.delete(); //no warp target found, something wrong
return;
}
obj.xPos = obj.xPos + obj.xSpeed;
obj.yPos = obj.yPos + obj.ySpeed;
jjPARTICLE@ part = jjAddParticle(PARTICLE::FIRE);
if (part !is null) {
part.xPos = obj.xPos + float(jjRandom() & 127) - 64;
part.yPos = obj.yPos + float(jjRandom() & 127) - 112;
}
if (obj.xPos < -96 || obj.xPos > jjLayerWidth[4] * 32 + 96 || obj.yPos < -96 || obj.yPos > jjLayerHeight[4] * 32 + 96) {
obj.delete();
return;
}
for (int x = 0; x < 3; ++x) for (int y = 0; y < 3; ++y) {
jjDrawTile(obj.xPos - 48 + x*32, obj.yPos - 92 + y*32, 847 + x + y*10);
}
}
void onObjectHit(jjOBJ@ obj, jjOBJ@ bull, jjPLAYER@ play, int force) {
if (obj.eventID == OBJECT::TNTDESTRUCTSCENERY && obj.state != STATE::DONE && obj.state != STATE::KILL && bull !is null && bull.behavior == LavaFlow) {
obj.energy = 0;
obj.state = STATE::KILL;
}
}
int startedGameTicks = 0;
void onMain() {
if (jjGameState != GAME::STOPPED && jjGameState != GAME::PAUSED) {
++startedGameTicks;
}
}
void onGameStart() {
startedGameTicks = 0;
}
void ChainPlatform(jjOBJ@ obj) {
if (obj.state == STATE::START) {
obj.counter = jjParameterGet(obj.xOrg / 32, obj.yOrg / 32, 0, 8) * 4;
obj.yAcc = jjParameterGet(obj.xOrg / 32, obj.yOrg / 32, 8, 8) * 32; //height
obj.state = STATE::BOUNCE;
}
obj.yPos = obj.yOrg + jjSin((obj.counter + startedGameTicks) * 1.23) * obj.yAcc + obj.yAcc / 2;
obj.beSolid();
float rootX = obj.xPos - 61, rootY = obj.yPos - 21;
for (uint x = 0; x < 4; ++x) for (uint y = 0; y < 4; ++y) {
jjDrawTile(rootX + x*32, rootY + y*32, 554 + x + y*10, TILE::ALLQUADRANTS, 3);
jjDrawTile(rootX + x*32, rootY + y*32, 514 + x + y*10, TILE::ALLQUADRANTS, 3);
}
for (uint x = 1; x < 3; ++x) for (float y = rootY - 32; y > -32; y -= 32) {
jjDrawTile(rootX + x*32, y, 349 + x + (int((y - rootY) / 32) & 7) * 10, TILE::ALLQUADRANTS, 3);
}
for (int i = 0; i < jjLocalPlayerCount; ++i) {
jjPLAYER@ play = jjLocalPlayers[i];
if (play.platform == obj.objectID && play.health > 0) play.yPos = obj.yPos - 42; //prevent stuttering on descent
}
}
void Alarm(jjOBJ@ obj) {
uint8 tintColor = 21;
uint curFrame = obj.curFrame;
if (obj.counter == 0) { //number of currently active bomb points
obj.lightType = LIGHT::NONE;
} else {
obj.lightType = LIGHT::NORMAL;
tintColor = 41; //orange
curFrame += jjGameTicks % 3;
}
jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, curFrame, 0, SPRITE::SINGLECOLOR, tintColor);
}
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.