Name | Author | Game Mode | Rating | |||||
---|---|---|---|---|---|---|---|---|
Anniversary Bash 26 CTF | Jazz2Online | Capture the flag | N/A |
const bool MLLESetupSuccessful = MLLE::Setup(); ///@MLLE-Generated
#include "MLLE-Include-1.6.asc" ///@MLLE-Generated
#pragma require "ab26ctf08-MLLE-Data-3.j2l" ///@MLLE-Generated
#pragma require "ab26ctf08-MLLE-Data-2.j2l" ///@MLLE-Generated
#pragma require "ab26ctf08-MLLE-Data-1.j2l" ///@MLLE-Generated
#pragma require "ab26ctf08.j2l" ///@MLLE-Generated
///@SaveAndRunArgs -server -capture ///@MLLE-Generated
#pragma require "SS1_Tree1B_Bright.png"
#pragma require "SS1_Tree2B_Bright.png"
#pragma require "SS1_Tree3B_Bright.png"
#pragma require "SS1_Tree4B_Bright.png"
#pragma require "SS1_Tree1A_Dark.png"
#pragma require "SS1_Tree2A_Dark.png"
#pragma require "SS1_Tree3A_Dark.png"
#pragma require "SS1_Tree4A_Dark.png"
void onLevelLoad() {
jjUseLayer8Speeds = true;
jjAnimSets[ANIM::CUSTOM[10]].load(
jjPIXELMAP("SS1_Tree1B_Bright.png"),
frameWidth: 256,
frameHeight: 320
);
jjAnimSets[ANIM::CUSTOM[11]].load(
jjPIXELMAP("SS1_Tree2B_Bright.png"),
frameWidth: 192,
frameHeight: 288
);
jjAnimSets[ANIM::CUSTOM[12]].load(
jjPIXELMAP("SS1_Tree3A_Bright.png"),
frameWidth: 128,
frameHeight: 192
);
jjAnimSets[ANIM::CUSTOM[13]].load(
jjPIXELMAP("SS1_Tree4B_Bright.png"),
frameWidth: 64,
frameHeight: 128
);
jjAnimSets[ANIM::CUSTOM[20]].load(
jjPIXELMAP("SS1_Tree1A_Dark.png"),
frameWidth: 256,
frameHeight: 320
);
jjAnimSets[ANIM::CUSTOM[21]].load(
jjPIXELMAP("SS1_Tree2A_Dark.png"),
frameWidth: 192,
frameHeight: 288
);
jjAnimSets[ANIM::CUSTOM[22]].load(
jjPIXELMAP("SS1_Tree3A_Dark.png"),
frameWidth: 128,
frameHeight: 192
);
jjAnimSets[ANIM::CUSTOM[23]].load(
jjPIXELMAP("SS1_Tree4A_Dark.png"),
frameWidth: 64,
frameHeight: 128
);
jjObjectPresets[OBJECT::APPLE].behavior = BrightTree_1();
jjObjectPresets[OBJECT::BANANA].behavior = BrightTree_2();
jjObjectPresets[OBJECT::BURGER].behavior = BrightTree_3();
jjObjectPresets[OBJECT::CAKE].behavior = BrightTree_4();
jjObjectPresets[OBJECT::CANDY].behavior = DarkTree_1();
jjObjectPresets[OBJECT::CHEESE].behavior = DarkTree_2();
jjObjectPresets[OBJECT::CHERRY].behavior = DarkTree_3();
jjObjectPresets[OBJECT::CHICKENLEG].behavior = DarkTree_4();
jjObjectPresets[OBJECT::APPLE].playerHandling =
jjObjectPresets[OBJECT::BANANA].playerHandling =
jjObjectPresets[OBJECT::BURGER].playerHandling =
jjObjectPresets[OBJECT::CAKE].playerHandling =
jjObjectPresets[OBJECT::CANDY].playerHandling =
jjObjectPresets[OBJECT::CHEESE].playerHandling =
jjObjectPresets[OBJECT::CHERRY].playerHandling =
jjObjectPresets[OBJECT::CHICKENLEG].playerHandling = HANDLING::PARTICLE;
jjObjectPresets[OBJECT::APPLE].bulletHandling =
jjObjectPresets[OBJECT::BANANA].bulletHandling =
jjObjectPresets[OBJECT::BURGER].bulletHandling =
jjObjectPresets[OBJECT::CAKE].bulletHandling =
jjObjectPresets[OBJECT::CANDY].bulletHandling =
jjObjectPresets[OBJECT::CHEESE].bulletHandling =
jjObjectPresets[OBJECT::CHERRY].bulletHandling =
jjObjectPresets[OBJECT::CHICKENLEG].bulletHandling = HANDLING::IGNOREBULLET;
jjObjectPresets[OBJECT::APPLE].isBlastable =
jjObjectPresets[OBJECT::BANANA].isBlastable =
jjObjectPresets[OBJECT::BURGER].isBlastable =
jjObjectPresets[OBJECT::CAKE].isBlastable =
jjObjectPresets[OBJECT::CANDY].isBlastable =
jjObjectPresets[OBJECT::CHEESE].isBlastable =
jjObjectPresets[OBJECT::CHERRY].isBlastable =
jjObjectPresets[OBJECT::CHICKENLEG].isBlastable = false;
generateCustomSpringSprites(jjAnimSets[ANIM::CUSTOM[9]], array<uint> = {40, 48, 16, 88});
turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 19.75f, false);
turnIntoCustomSpring(jjObjectPresets[OBJECT::HORREDSPRING], 1, 17.75f, false);
turnIntoCustomSpring(jjObjectPresets[OBJECT::HORGREENSPRING], 2, 27.45f, false);
turnIntoCustomSpring(jjObjectPresets[OBJECT::HORBLUESPRING], 3, 33.0f, false);
jjObjectPresets[OBJECT::HORREDSPRING].causesRicochet = jjObjectPresets[OBJECT::HORBLUESPRING].causesRicochet = jjObjectPresets[OBJECT::HORGREENSPRING].causesRicochet = false;
jjWeapons[WEAPON::GUN8].spread = SPREAD::NORMAL;
jjObjectPresets[OBJECT::FIREBALLBULLETPU].var[6] = 8 + 16;
}
class BrightTree_1 : jjBEHAVIORINTERFACE {
void onBehave(jjOBJ@ obj) {
if (inView(obj) && !jjLowDetail) {
//jjDrawSprite(obj.xPos, obj.yPos, obj.eventID == OBJECT::APPLE? ANIM::CUSTOM[10] : ANIM::CUSTOM[10], 0, (jjGameTicks/4) % 12, 0, SPRITE::NORMAL, 0, 11, 5);
}
}
}
class BrightTree_2 : jjBEHAVIORINTERFACE {
void onBehave(jjOBJ@ obj) {
if (inView(obj) && !jjLowDetail) {
//jjDrawSprite(obj.xPos, obj.yPos, obj.eventID == OBJECT::BANANA? ANIM::CUSTOM[11] : ANIM::CUSTOM[11], 0, (jjGameTicks/4) % 12, 0, SPRITE::NORMAL, 0, 11, 5);
}
}
}
class BrightTree_3 : jjBEHAVIORINTERFACE {
void onBehave(jjOBJ@ obj) {
if (inView(obj) && !jjLowDetail) {
//jjDrawSprite(obj.xPos, obj.yPos, obj.eventID == OBJECT::BURGER? ANIM::CUSTOM[12] : ANIM::CUSTOM[12], 0, (jjGameTicks/4) % 12, 0, SPRITE::NORMAL, 0, 11, 5);
}
}
}
class BrightTree_4 : jjBEHAVIORINTERFACE {
void onBehave(jjOBJ@ obj) {
if (inView(obj) && !jjLowDetail) {
//jjDrawSprite(obj.xPos, obj.yPos, obj.eventID == OBJECT::CAKE? ANIM::CUSTOM[13] : ANIM::CUSTOM[13], 0, (jjGameTicks/4) % 12, 0, SPRITE::NORMAL, 0, 11, 5);
}
}
}
class DarkTree_1 : jjBEHAVIORINTERFACE {
void onBehave(jjOBJ@ obj) {
if (inView(obj) && !jjLowDetail) {
jjDrawSprite(obj.xPos, obj.yPos, obj.eventID == OBJECT::CANDY? ANIM::CUSTOM[20] : ANIM::CUSTOM[20], 0, (jjGameTicks/4) % 12, 0, SPRITE::NORMAL, 0, 8, 5);
}
}
}
class DarkTree_2 : jjBEHAVIORINTERFACE {
void onBehave(jjOBJ@ obj) {
if (inView(obj) && !jjLowDetail) {
jjDrawSprite(obj.xPos, obj.yPos, obj.eventID == OBJECT::CHEESE? ANIM::CUSTOM[21] : ANIM::CUSTOM[21], 0, (jjGameTicks/4) % 12, 0, SPRITE::NORMAL, 0, 8, 5);
}
}
}
class DarkTree_3 : jjBEHAVIORINTERFACE {
void onBehave(jjOBJ@ obj) {
if (inView(obj) && !jjLowDetail) {
jjDrawSprite(obj.xPos, obj.yPos, obj.eventID == OBJECT::CHERRY? ANIM::CUSTOM[22] : ANIM::CUSTOM[22], 0, (jjGameTicks/4) % 12, 0, SPRITE::NORMAL, 0, 8, 5);
}
}
}
class DarkTree_4 : jjBEHAVIORINTERFACE {
void onBehave(jjOBJ@ obj) {
if (inView(obj) && !jjLowDetail) {
jjDrawSprite(obj.xPos, obj.yPos, obj.eventID == OBJECT::CHICKENLEG? ANIM::CUSTOM[23] : ANIM::CUSTOM[23], 0, (jjGameTicks/4) % 12, 0, SPRITE::NORMAL, 0, 8, 5);
}
}
}
bool inView(const jjOBJ@ obj) {
for (int i = 0; i < jjLocalPlayerCount; i++) {
const jjPLAYER@ play = jjLocalPlayers[i];
if (obj.xPos > play.cameraX - 144 && obj.yPos > play.cameraY - 144 && obj.xPos < play.cameraX + jjSubscreenWidth + 144 && obj.yPos < play.cameraY + jjSubscreenHeight + 144)
return true;
}
return false;
}
void onMain() {
jjWeapons[WEAPON::GUN8].comesFromGunCrates = true;
array<jjLAYER@> layers = jjLayerOrderGet();
layers[22].xOffset += .20f;
layers[24].xOffset += .10f;
for (int i = 1; i < jjObjectCount; i++) {
jjOBJ@ obj = jjObjects[i];
if (obj.eventID == OBJECT::BOUNCERPOWERUP){
obj.direction = 0;
}
if (jjGameTicks == 2) {
if (jjObjects[i].eventID == OBJECT::APPLE || jjObjects[i].eventID == OBJECT::BANANA || jjObjects[i].eventID == OBJECT::BURGER || jjObjects[i].eventID == OBJECT::CAKE) {
Tree newTree;
newTree.xPos = jjObjects[i].xPos;
newTree.yPos = jjObjects[i].yPos;
switch (jjObjects[i].eventID) {
case OBJECT::APPLE: newTree.anim = 10; break;
case OBJECT::BANANA: newTree.anim = 11; break;
case OBJECT::BURGER: newTree.anim = 12; break;
case OBJECT::CAKE: newTree.anim = 13; break;
}
Trees.insertLast(newTree);
}
}
}
if (!jjLowDetail) {
jjIsSnowing = jjGameTicks % 25 == 0? true:false;
} else {
jjIsSnowing = false;
}
for (int i = 0; i < 1024; i++) {
jjPARTICLE@ particle = jjParticles[i];
if (particle.type == PARTICLE::LEAF) {
particle.xSpeed = -1.3;
particle.ySpeed = 0.05;
}
}
}
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.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@ play) {
if (play.ySpeed < -32.f) {
fastCustomSpringSpeeds[play.localPlayerID] = int(ceil((play.ySpeed + 32.f) / -0.125f));
} else if (fastCustomSpringSpeeds[play.localPlayerID] != 0) {
if (play.ySpeed < -31.f) {
fastCustomSpringSpeeds[play.localPlayerID]--;
play.ySpeed = -32.f;
} else {
fastCustomSpringSpeeds[play.localPlayerID] = 0;
}
}
}
void onPlayer(jjPLAYER@ play) {
handleFastCustomSpringSpeeds(play);
}
class Tree {
float xPos, yPos;
int anim;
}
array<Tree> Trees;
void onDrawLayer6(jjPLAYER@ play, jjCANVAS@ canvas) {
if (!jjLowDetail) {
for (uint i = 0; i < Trees.length(); i++) {
Tree@ tree = Trees[i];
if (tree.xPos > play.cameraX - 512 && tree.yPos > play.cameraY - 512 && tree.xPos < play.cameraX + jjSubscreenWidth + 512 && tree.yPos < play.cameraY + jjSubscreenHeight + 512) {
canvas.drawResizedSprite(int(tree.xPos), int(tree.yPos), ANIM::CUSTOM[tree.anim], 0, (jjGameTicks/4) % 12, 1, 1, SPRITE::NORMAL);
}
}
}
}
void onLevelBegin() {
MLLE::SpawnOffgrids();
for (int i = 1; i < jjObjectCount; i++) {
if (jjObjects[i].eventID == OBJECT::CTFBASE || jjObjects[i].behavior == BEHAVIOR::FLAG) jjObjects[i].yOrg -= 3;
if (jjObjects[i].eventID == OBJECT::FULLENERGY) jjObjects[i].yOrg -= 3;
}
}
/*
class CannotBeShotDown : jjBEHAVIORINTERFACE {
CannotBeShotDown(const jjBEHAVIOR &in behavior) {
originalBehavior = behavior;
}
void onBehave(jjOBJ@ obj) {
obj.behave(originalBehavior);
if (obj.state == STATE::FLOATFALL)
obj.state = STATE::FLOAT;
}
bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) {
if (bullet is null) {
obj.behavior = originalBehavior;
if (player.objectHit(obj, force, obj.playerHandling))
return true;
obj.behavior = this;
}
return false;
}
private jjBEHAVIOR originalBehavior;
}
*/
void onLevelReload() {
MLLE::SpawnOffgridsLocal();
}
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.