Name | Author | Game Mode | Rating | |||||
---|---|---|---|---|---|---|---|---|
Anniversary Bash 18 Levels | Jazz2Online | Multiple | N/A | |||||
Spacey Space Station | TreyLina | Battle | 8.3 |
jjANIMSET@ customSpringSprite;
array<int> fastCustomSpringSpeeds(jjLocalPlayerCount);
bool generateCustomSpringSprites(jjANIMSET@ anim, const array<uint> &in colors) {
int length = colors.length();
bool success = (@customSpringSprite = anim).allocate(array<uint>(length * 3, 5)) !is null;
if (success) {
uint srcSet = jjAnimSets[ANIM::SPRING];
for (int i = 0; i < length; i++) {
uint color = colors[i];
uint destAnimOffset = anim + i * 3;
for (int j = 0; j < 3; j++) {
uint srcAnim = jjAnimations[srcSet + j];
uint destAnim = jjAnimations[destAnimOffset + j];
for (int k = 0; k < 5; k++) {
jjPIXELMAP image(jjAnimFrames[destAnim + k] = jjAnimFrames[srcAnim + k]);
int width = image.width;
int height = image.height;
for (int l = 0; l < height; l++) {
for (int m = 0; m < width; m++) {
int pixel = image[m, l];
if (pixel >= 32 && pixel < 40)
image[m, l] = color + (pixel & 7);
}
}
if (!image.save(jjAnimFrames[destAnim + k]))
return false;
}
}
}
}
return success;
}
void initializeCustomSpring(jjOBJ@ obj) {
int anim = obj.curAnim;
obj.behave(obj.behavior = BEHAVIOR::SPRING, false);
if (obj.curAnim != anim) {
obj.curAnim = anim + 2;
obj.determineCurFrame();
}
obj.draw();
}
void turnIntoCustomSpring(jjOBJ@ obj, uint color, float power, bool horizontal) {
if (horizontal) {
obj.xSpeed = power;
obj.ySpeed = 0.f;
} else {
obj.xSpeed = 0.f;
obj.ySpeed = -power;
if (obj.state == STATE::START && obj.creatorType == CREATOR::LEVEL) {
int x = int(obj.xPos) >> 5;
int y = int(obj.yPos) >> 5;
if (jjParameterGet(x, y, 0, 1) != 0) {
jjParameterSet(x, y, 0, 1, 0);
obj.yPos -= 4.f;
obj.ySpeed = power;
}
}
}
obj.behavior = initializeCustomSpring;
obj.curAnim = customSpringSprite + color * 3 + (horizontal ? 1 : 0);
obj.energy = obj.frameID = obj.freeze = obj.justHit = obj.light = obj.points = 0;
obj.causesRicochet = obj.isBlastable = obj.isTarget = obj.scriptedCollisions = obj.triggersTNT = false;
obj.deactivates = obj.isFreezable = true;
obj.bulletHandling = HANDLING::IGNOREBULLET;
obj.playerHandling = HANDLING::SPECIAL;
obj.lightType = LIGHT::NORMAL;
obj.determineCurFrame();
}
void handleFastCustomSpringSpeeds(jjPLAYER@ player) {
if (player.ySpeed < -32.f) {
fastCustomSpringSpeeds[player.localPlayerID] = int(ceil((player.ySpeed + 32.f) / -0.125f));
} else if (fastCustomSpringSpeeds[player.localPlayerID] != 0) {
if (player.ySpeed < -31.f) {
fastCustomSpringSpeeds[player.localPlayerID]--;
player.ySpeed = -32.f;
} else {
fastCustomSpringSpeeds[player.localPlayerID] = 0;
}
}
}
void onLevelLoad() {
jjObjectPresets[OBJECT::FASTFEET].scriptedCollisions = true;
generateCustomSpringSprites(jjAnimSets[ANIM::CUSTOM[0]], array<uint> = {72});
turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 35, false);
jjLayerXOffset[7] = 128;
jjLayerYOffset[7] = 128;
}
void onPlayer(jjPLAYER@ play) {
handleFastCustomSpringSpeeds(play);
if (play.timerTime > 0) {
play.jumpStrength = -65;
if (jjMaskedHLine(int(play.xPos - 12) , 24, int(play.yPos + 20)) && play.ySpeed >= 0) {
if (play.keyJump && play.specialMove == 0) {
jjSample(play.xPos, play.yPos, SOUND::PICKUPS_BOING_CHECK, 0, 0);
}
}
else if (jjEventGet(int(play.xPos/32),(int(play.yPos))/32) == AREA::VINE && play.ySpeed == 0 && play.keyJump && !play.keyDown) {
jjSample(play.xPos, play.yPos, SOUND::PICKUPS_BOING_CHECK, 0, 0);
}
}
else play.jumpStrength = -10;
if (play.health == 0) play.timerStop();
}
void onPlayerTimerEnd(jjPLAYER@) {}
void onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ play, int force) {
if (obj.eventID == OBJECT::FASTFEET) {
if (play.isLocal) {play.timerStart(1800);}
jjSample(obj.xPos, obj.yPos, SOUND::COMMON_PICKUP1, 0, 0);
obj.behavior = BEHAVIOR::EXPLOSION2;
obj.scriptedCollisions = false;
obj.frameID = 0;
}
}
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.