Name | Author | Game Mode | Rating | |||||
---|---|---|---|---|---|---|---|---|
Anniversary Bash 20 Levels | Jazz2Online | Multiple | N/A |
#include "MLLE-Include-1.3.asc"
const bool MLLESetupSuccessful = MLLE::Setup();
bool coinMsg = false;
void onLevelLoad() {
jjPalette.fill(4,0,8,176,1,1);
loadAnims();
loadAnims1();
ReplacePlatform();
jjAnimations[jjAnimSets[ANIM::SONICPLAT] ] = jjAnimations[jjAnimSets[ANIM::AMMO] + 8];
jjObjectPresets[OBJECT::TNTAMMO3].scriptedCollisions
= true;
jjObjectPresets[OBJECT::TNTAMMO3].behavior
= StillPickup();
jjObjectPresets[OBJECT::CRAB].causesRicochet = true;
// jjObjectPresets[OBJECT::PLASMASHIELDBULLET].causesRicochet = true;
jjObjectPresets[OBJECT::PLASMASHIELDBULLET].playerHandling = HANDLING::SPECIAL;
jjObjectPresets[OBJECT::PLASMASHIELDBULLET].bulletHandling = HANDLING::DESTROYBULLET;
jjObjectPresets[OBJECT::PLASMASHIELDBULLET].scriptedCollisions = true;
// jjObjectPresets[OBJECT::PLASMASHIELDBULLETPU].causesRicochet = true;
jjObjectPresets[OBJECT::ICEBULLET].behavior = jjObjectPresets[OBJECT::ICEBULLETPU].behavior = ElektrekShield();
jjObjectPresets[OBJECT::ICEBULLET].freeze = jjObjectPresets[OBJECT::ICEBULLETPU].freeze = 0;
jjObjectPresets[OBJECT::PLASMASHIELDBULLET].behavior = ElektrekShield1();
jjObjectPresets[OBJECT::ELECTROBULLETPU].behavior = electrosnake();
//jjObjectPresets[OBJECT::ELECTROBULLETPU].xSpeed=0;
jjObjectPresets[OBJECT::TNT].behavior = Zeus_Artillery();
jjObjectPresets[OBJECT::PLASMASHIELDBULLET].counterEnd = 20;
jjWeapons[WEAPON::ICE].style = WEAPON::CAPPED;
//jjWeapons[WEAPON::ICE].spread = SPREAD::RFPU;
jjWeapons[WEAPON::GUN9].spread = SPREAD::RFPU;
jjWeapons[WEAPON::TNT].maximum = 18;
jjAnimations[jjAnimSets[ANIM::AMMO] + 29] = jjAnimations[jjAnimSets[ANIM::DEMON] + 0];
jjANIMATION@ anim = jjAnimations[jjAnimSets[ANIM::AMMO] + 14];
for (uint j = 0; j < anim.frameCount; j++) {
jjANIMFRAME@ frame = jjAnimFrames[anim + j];
jjPIXELMAP sprite(frame);
for (uint x = 0; x < sprite.width; ++x) {
for (uint y = 0; y < sprite.height; ++y) {
if (sprite[x,y] >= 40 && sprite[x,y] <= 47) sprite[x,y] += 48;
}
}
sprite.save(frame);
}
//jjWeapons[WEAPON::ICE].multiplier = 32;
//jjObjectPresets[OBJECT::PLASMASHIELDBULLET].playerHandling = HANDLING::PLAYERBULLET;
jjUseLayer8Speeds = true;
jjTexturedBGTexture = TEXTURE::NORMAL;
}
void onMain() {
//jjTexturedBGFadePositionX = jjSin(jjGameTicks << 1) / 2 + .5;
//jjTexturedBGFadePositionY = jjCos(jjGameTicks << 1) / 2 + .5;
jjLayerYOffset[8] =
jjSin(jjGameTicks)*64
;
if(jjGameTicks%10 == 1)
{
jjSetFadeColors(128+jjSin(jjGameTicks/8)*126, 128+jjSin(jjGameTicks/8+341)*126,128+ jjSin(jjGameTicks/8+683)*126
)
;
}
}
void onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ play, int force) {
if (obj.eventID == OBJECT::TNTAMMO3)
{
play.ammo[WEAPON::TNT] =20;
play.currWeapon = WEAPON::TNT;
}
if (obj.eventID == OBJECT::PLASMASHIELDBULLET) {
if (obj.creatorID!= play.playerID) {
if ( (force==-1) || ( force == 0))
play.hurt(1, false, jjPlayers[obj.creatorID]);
//else
//play.hurt(0, false, jjPlayers[obj.creatorID]);
}
}
}
uint8 animShield = 0;
void loadAnims() {
jjANIMSET@ shieldAnimSet = jjAnimSets[ANIM::BAT];
if (shieldAnimSet.firstAnim == 0) {
const int firstShieldTileID = jjTileCount;
const int shieldFrameCount = 2;
jjTilesFromTileset("daysis691.j2t", 825, shieldFrameCount);
shieldAnimSet.allocate(array<uint> = {shieldFrameCount});
const int firstShieldFrameID = jjAnimations[shieldAnimSet.firstAnim].firstFrame;
for (int shieldFrameID = 0; shieldFrameID < shieldFrameCount; ++shieldFrameID) {
jjPIXELMAP shieldImage(firstShieldTileID + shieldFrameID);
jjANIMFRAME@ shieldFrame = jjAnimFrames[firstShieldFrameID + shieldFrameID];
shieldImage.save(shieldFrame);
shieldFrame.hotSpotX = -16;
shieldFrame.hotSpotY = -24;
}
}
}
void loadAnims1() {
jjANIMSET@ shieldAnimSet = jjAnimSets[ANIM::DEMON];
if (shieldAnimSet.firstAnim == 0) {
const int firstShieldTileID = jjTileCount;
const int shieldFrameCount = 1;
jjTilesFromTileset("daysis691.j2t", 835, shieldFrameCount);
shieldAnimSet.allocate(array<uint> = {shieldFrameCount});
const int firstShieldFrameID = jjAnimations[shieldAnimSet.firstAnim].firstFrame;
for (int shieldFrameID = 0; shieldFrameID < shieldFrameCount; ++shieldFrameID) {
jjPIXELMAP shieldImage(firstShieldTileID + shieldFrameID);
jjANIMFRAME@ shieldFrame = jjAnimFrames[firstShieldFrameID + shieldFrameID];
shieldImage.save(shieldFrame);
shieldFrame.hotSpotX = -16;
shieldFrame.hotSpotY = -24;
}
}
}
int ii;
int kk;
class ElektrekShield : jjBEHAVIORINTERFACE {
void onBehave(jjOBJ@ obj) {
if (obj.state == STATE::START) {
obj.state = STATE::EXPLODE;
} else if (obj.state == STATE::EXPLODE) {
for (int ii=0; ii < 8;ii++) {
int q = jjAddObject((obj.eventID == OBJECT::ICEBULLET) ? OBJECT::PLASMASHIELDBULLET : OBJECT::PLASMASHIELDBULLET, 1000, 1000, obj.creatorID, CREATOR::PLAYER);
jjOBJ@ o = jjObjects[q];
o.counterEnd = 20;
o.creatorID = obj.creatorID ;
o.light = ii;
o.lightType = LIGHT::NORMAL;
}
obj.delete();
}
}
}
class electrosnake : jjBEHAVIORINTERFACE {
void onBehave(jjOBJ@ obj) {
int targetID = obj.findNearestPlayer(100000000000);
obj.light = 0;
obj.lightType = LIGHT::NORMAL;
uint z = (jjGameTicks/7) % 2 ;
obj.determineCurAnim(ANIM::BAT,0,true);
jjDrawRotatedSprite(obj.xPos, obj.yPos, ANIM::BAT, 0, z, 2*256-(512/3.14)*atan2(obj.ySpeed, obj.xSpeed));
//obj.counter++;
int m = 10;
obj.counterEnd= 500;
//obj.behavior == BEHAVIOR::BULLET;
obj.behave(BEHAVIOR::BULLET, obj.state == STATE::FLY? false:true);
if ( obj.state == STATE::FLY) {
obj.xAcc=obj.yAcc=0;
if (obj.creatorID != targetID && jjPlayers[targetID].team != jjPlayers[obj.creatorID].team || obj.creatorID != targetID && jjPlayers[targetID].isInGame) {
if (obj.counter % 30 <15){
if (jjPlayers[targetID].xPos <= obj.xPos){
obj.xSpeed = -5;
obj.ySpeed = 0;
}
if (jjPlayers[targetID].xPos > obj.xPos) {
obj.xSpeed= 5;
obj.ySpeed = 0;
}
}
if (obj.counter % 30 >= 15){
if (jjPlayers[targetID].yPos <= obj.yPos){
obj.ySpeed= -5;
obj.xSpeed =0;
}
if (jjPlayers[targetID].yPos > obj.yPos){
obj.ySpeed= 5;
obj.xSpeed =0;
}
}}
}
}
}
class electrosnake1 : jjBEHAVIORINTERFACE {
void onBehave(jjOBJ@ obj) {
int targetID = obj.findNearestPlayer(100000000000);
uint z = (jjGameTicks/7) % 2 ;
obj.determineCurAnim(ANIM::BAT,14,true);
jjDrawRotatedSprite(obj.xPos, obj.yPos, ANIM::BAT, 0, z, -(512/3.14)*atan2(obj.ySpeed, obj.xSpeed));
//obj.counter++;
int m = 10;
obj.counterEnd= 500;
//obj.behavior == BEHAVIOR::BULLET;
obj.behave(BEHAVIOR::BULLET, obj.state == STATE::FLY? false:true);
if ( obj.state == STATE::FLY) {
obj.xAcc=obj.yAcc=0;
if (obj.creatorID != targetID && jjPlayers[targetID].team != jjPlayers[obj.creatorID].team || obj.creatorID != targetID && jjGameMode == GAME::BATTLE) {
if (obj.counter % 30 <15){
if (jjPlayers[targetID].xPos <= obj.xPos){
obj.xSpeed = -5;
obj.ySpeed = 0;
}
if (jjPlayers[targetID].xPos > obj.xPos) {
obj.xSpeed= 5;
obj.ySpeed = 0;
}
}
if (obj.counter % 30 >= 15){
if (jjPlayers[targetID].yPos <= obj.yPos){
obj.ySpeed= -5;
obj.xSpeed =0;
}
if (jjPlayers[targetID].yPos > obj.yPos){
obj.ySpeed= 5;
obj.xSpeed =0;
}
}}
}
}
}
class ElektrekShield1 : jjBEHAVIORINTERFACE {
void onBehave(jjOBJ@ o) {
uint z = (jjGameTicks/7) % 2 ;
o.determineCurAnim(ANIM::BAT,14,true);
//obj.frameID = 2;
//obj.determineCurFrame();
//obj.draw();
jjDrawRotatedSprite(o.xPos, o.yPos, ANIM::BAT, 0, z, 256+(512/3.14)*atan2(-jjPlayers[o.creatorID].yPos+o.yPos, jjPlayers[o.creatorID].xPos-o.xPos));
o.behavior == BEHAVIOR::BULLET;
o.counterEnd = 20;
switch(o.light) {
case 0:
{
o.xPos = jjPlayers[o.creatorID].xPos + 70*jjSin(-jjGameTicks*20);
o.yPos = jjPlayers[o.creatorID].yPos + 70*jjCos(-jjGameTicks*20);
break;
}
case 1:
{
o.xPos = jjPlayers[o.creatorID].xPos + 70*jjSin((-jjGameTicks-32)*20);
o.yPos = jjPlayers[o.creatorID].yPos + 70*jjCos((-jjGameTicks-32)*20);
break;
}
case 2:
{
o.xPos = jjPlayers[o.creatorID].xPos + 70*jjSin((-jjGameTicks-32-32)*20);
o.yPos = jjPlayers[o.creatorID].yPos + 70*jjCos((-jjGameTicks-32-32)*20);
break;
}
case 3:
{
o.xPos = jjPlayers[o.creatorID].xPos + 70*jjSin((-jjGameTicks-32-32-32)*20);
o.yPos = jjPlayers[o.creatorID].yPos + 70*jjCos((-jjGameTicks-32-32-32)*20);
break;
}
case 4:
{
o.xPos = jjPlayers[o.creatorID].xPos + 70*jjSin((-jjGameTicks-32-32-32-32)*20);
o.yPos = jjPlayers[o.creatorID].yPos + 70*jjCos((-jjGameTicks-32-32-32-32)*20);
break;
}
case 5:
{
o.xPos = jjPlayers[o.creatorID].xPos + 70*jjSin((-jjGameTicks-32-32-32-32-32)*20);
o.yPos = jjPlayers[o.creatorID].yPos + 70*jjCos((-jjGameTicks-32-32-32-32-32)*20);
break;
}
case 6:
{
o.xPos = jjPlayers[o.creatorID].xPos + 70*jjSin((-jjGameTicks-32-32-32-32-32-32)*20);
o.yPos = jjPlayers[o.creatorID].yPos + 70*jjCos((-jjGameTicks-32-32-32-32-32-32)*20);
break;
}
case 7:
{
o.xPos = jjPlayers[o.creatorID].xPos + 70*jjSin((-jjGameTicks-32-32-32-32-32-32-32)*20);
o.yPos = jjPlayers[o.creatorID].yPos + 70*jjCos((-jjGameTicks-32-32-32-32-32-32-32)*20);
break;
}
}
o.counter++;
if (o.counter > 40)
o.delete();
}
}
class StillPickup : jjBEHAVIORINTERFACE {
void onBehave(jjOBJ@ obj) {
if (obj.xPos > 100*32)
obj.direction = 1;
if (obj.xPos < 100*32)
obj.direction = -1;
if (obj.state == STATE::FLOATFALL) obj.state = STATE::FLOAT;
obj.behave(BEHAVIOR::PICKUP);
}
}
void onPlayer(jjPLAYER@ p) {
if (p.fly == FLIGHT::FLYCARROT && p.timerState == TIMER::STOPPED) p.timerStart(10*70);
if (p.fly == FLIGHT::NONE) p.timerStop();
if (p.timerState == TIMER::STARTED && p.timerTime <= 3*70 && p.timerTime > 0 && p.timerTime % 70 == 0) jjSamplePriority(SOUND::COMMON_NOCOIN);
for (int i = 1; i < jjObjectCount; ++i) {
switch (jjObjects[i].eventID) {
case OBJECT::SILVERCOIN:
if (p.coins >= 1) {
p.coins = 1;
jjObjects[i].playerHandling = HANDLING::PARTICLE;
}
else jjObjects[i].playerHandling = HANDLING::PICKUP;
break;
case OBJECT::FLYCARROT:
if (jjObjects[i].state == STATE::FLOATFALL) jjObjects[i].state = STATE::FLOAT;
break;
}
}
if (p.coins >= 1 && !coinMsg) {
jjAlert("|||||||You picked up a shield token!");
coinMsg = true;
}
if (p.coins == 0) coinMsg = false;
}
void onPlayerTimerEnd(jjPLAYER@ p) { p.fly = FLIGHT::NONE; }
void onFunction9(jjPLAYER@ p) {
if (p.testForCoins(1)) {
p.shieldType = SHIELD::PLASMA;
p.shieldTime = 20*70;
jjSamplePriority(SOUND::COMMON_GLASS2);
jjSamplePriority(SOUND::COMMON_SHIELD1);
}
}
bool onDrawHealth(jjPLAYER@ p, jjCANVAS@ canvas) {
if (p.shieldType != 0 && p.shieldTime > 0) {
canvas.drawString(
jjSubscreenWidth-100,
jjSubscreenHeight-464,
"||||||||Shield!",
STRING::MEDIUM,
STRING::NORMAL
);
return true;
}
return false;
}
bool onDrawPlayerTimer(jjPLAYER@ p, jjCANVAS@ canvas) {
if (p.fly == FLIGHT::FLYCARROT) {
canvas.drawString(
jjSubscreenWidth - 55,
jjSubscreenHeight - 284,
"" + (p.timerTime + 70) / 70,
STRING::LARGE,
STRING::PALSHIFT,
p.timerTime > 3*70?
0 :
jjGameTicks % 28 > 14?
-40 :
-24
);
canvas.drawSprite(
jjSubscreenWidth - 72,
jjSubscreenHeight - 270,
ANIM::PICKUPS,
40,
0
);
}
return true;
}
class Zeus_Artillery : jjBEHAVIORINTERFACE {
float startX, startY;
void onBehave(jjOBJ@ obj) {
if (obj.state == STATE::START) {
obj.state = STATE::FLY;
startX = jjPlayers[obj.creatorID].xPos;
startY = jjPlayers[obj.creatorID].yPos;
obj.xPos = startX;
obj.yPos = 1;
obj.playerHandling = HANDLING::SPECIAL;
obj.animSpeed = 3;
obj.ySpeed = 13;
} else if (obj.state == STATE::EXPLODE) {
for (int i=-50; i < 50;i++) {
int w = jjAddObject(OBJECT::RFBULLET, obj.xPos + (jjRandom()%200) - 100, obj.yPos + (jjRandom()%200) - 100, obj.creatorID, CREATOR::PLAYER);
jjOBJ@ o = jjObjects[w];
o.playerHandling = HANDLING::SPECIAL;
o.counterEnd = 1;
o.animSpeed = 2;
if (o.doesCollide(jjPlayers[p.playerID]) && p.playerID != o.creatorID && p.blink == 0)
if ((p.team != jjPlayers[o.creatorID].team && jjGameMode == GAME::CTF) || jjGameMode == GAME::BATTLE || jjGameMode == GAME::RACE )
if (jjGameState == GAME::STARTED)
p.hurt(2, false, jjPlayers[o.creatorID]);
}
obj.behavior = BEHAVIOR::EXPLOSION2;
} else {
jjPARTICLE@ particle = jjAddParticle(PARTICLE::STAR);
if (particle !is null) {
particle.xPos = obj.xPos;
particle.yPos = obj.yPos;
particle.xSpeed = jjRandom()&5;
particle.ySpeed = jjRandom()&5;
particle.star.color = jjRandom()%100;
particle.star.size = jjRandom()%50 + 1;
particle.star.frame = jjRandom()%2 - 1;
}
int tail = jjAddObject(OBJECT::SEEKERBULLET, obj.xPos, obj.yPos, obj.creatorID, CREATOR::PLAYER);
jjObjects[tail].counterEnd = 0;
obj.determineCurAnim(ANIM::BOLLPLAT, 0, true);
obj.determineCurFrame(true);
obj.killAnim = jjObjects[OBJECT::SEEKERBULLET].killAnim;
obj.yPos += obj.ySpeed;
obj.draw();
if (obj.yPos >= startY) obj.state = STATE::EXPLODE;
}
}
}
void ReplacePlatform() {
jjPIXELMAP platform(11, 146*32+10, 74, 118, 5);
jjANIMFRAME@ frame = jjAnimFrames[jjAnimations[jjAnimSets[ANIM::BOLLPLAT].firstAnim].firstFrame];
platform.save(frame);
frame.hotSpotX = -frame.width/2;
frame.hotSpotY = -frame.height/2;
}
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.