Downloads containing ab23btl20.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Anniversary Bash 23 levels Jazz2Online Multiple N/A Download file

File preview

const bool MLLESetupSuccessful = MLLE::Setup(array<MLLEWeaponApply@> = {null, SzmolWeaponPack::PetrolBomb::Weapon(), null, null, null, null, null, null, null}); ///@MLLE-Generated
#include "MLLE-Include-1.5w.asc" ///@MLLE-Generated
#pragma require "ab23btl20.j2l" ///@MLLE-Generated
#include "petrolBomb.asc" ///@MLLE-Generated
#pragma require "petrolBomb.asc" ///@MLLE-Generated

#pragma require "MegaM123P.j2t"

/*******************************
A 2020 Mystic Legends Release!
http://www.mysticlegends.org
/******************************/

void onLevelLoad() {
	jjPAL pink;
	pink.load("MegaM123P.j2t");
	jjPalette.copyFrom(10, 86, 10, pink, 0.65f);
	jjPalette.apply();
	
	jjLayers[4].generateSettableTileArea();
	
	jjObjectPresets[OBJECT::TNTAMMO3].determineCurAnim(ANIM::AMMO, 1);
	jjObjectPresets[OBJECT::TNTAMMO3].determineCurFrame();
	jjObjectPresets[OBJECT::TNTAMMO3].direction = SPRITE::FLIPH;
	
	jjObjectPresets[OBJECT::TNTAMMO3].behavior = FallingItem;
	
	jjUseLayer8Speeds = true;
}

void onLevelBegin() {
	jjPAL standard;
	standard.load("Diam2.j2t");
	jjPalette.copyFrom(16, 40, 16, standard, 1);
	jjPalette.copyFrom(59, 37, 59, standard, 1);
	jjPalette.apply();
}

void onPlayer(jjPLAYER@ play) {
	play.cameraFreeze(0, 0, false, true);	
	play.noFire = (play.currWeapon == WEAPON::BLASTER);
	
	jjWeapons[WEAPON::BOUNCER].maximum = 
	jjWeapons[WEAPON::TNT].maximum = 1;
}

void FallingItem(jjOBJ@ obj) {
	if (obj.state == STATE::FLOAT) obj.state = STATE::FLOATFALL;
	obj.behave(BEHAVIOR::PICKUP);
}

//Lots of very old, obsoleted code follows from here on. Tread carefully!
//Consult an actual coder if you want to implement some of these features

void destroyTileAt(float X, float Y, int angle) {
	int16 xTile = int16(X / 32);
	int16 yTile = int16(Y / 32);

	uint16 tileToDestroy = jjTileGet(4, xTile, yTile);
	if (tileToDestroy > 0) {
		jjAddParticleTileExplosion(xTile, yTile, 34, false);
		jjSample((xTile/32), (yTile/32), SOUND::COMMON_DAMPED1);
	}
	jjTileSet(3, xTile, yTile, 0);
	jjTileSet(4, xTile, yTile, 0);
	jjTileSet(5, xTile, yTile, 0);
}

//Foly's bomb

/***Constants***/
const float cBombSpeed = 8; //xSpeed of the bomb
const float cBombPlayerSpeed = 6; //xSpeed the bomb can gain by player speed (if a player is running full speed it will add 6 xSpeed)
const int cBombLifeTime = 70*2; //Time till the bomb explodes (run away! run away!!!1)
 
/***Other functions***/
void CreateBomb(int objectID) {
  int playerID = jjObjects[objectID].creator - 32768;
  int bombID = jjAddObject(OBJECT::APPLE, jjPlayers[playerID].xPos, jjPlayers[playerID].yPos, jjPlayers[playerID].playerID, CREATOR::PLAYER);
  jjObjects[bombID].objType = 3;
  jjObjects[bombID].determineCurAnim(ANIM::AMMO, 1, true);
  jjObjects[bombID].special = 11;
  jjObjects[bombID].xSpeed = cBombSpeed*jjPlayers[playerID].direction + cBombPlayerSpeed*jjPlayers[playerID].xSpeed/16;
  jjObjects[bombID].ySpeed = -3;
}

const array<string> WildScreamsOfJoyAtExplosions = {
	"FUCKYEAH",
	"BOEM",
	"WHOOOOO",
	"BANG",
	"FUCK OFF",
	"YEEAAHHH",
	"HAHAHA"
	"WEUW"
};
 
void DestroyBomb(int bombID) {
	int explosionID = jjAddObject(OBJECT::TNT, jjObjects[bombID].xPos, jjObjects[bombID].yPos, jjObjects[bombID].creator, CREATOR::PLAYER);
	//jjDeleteObject(bombID);
	jjObjects[explosionID].determineCurAnim(ANIM::AMMO, 1, true);
	jjObjects[explosionID].killAnim = ANIM::AMMO;
	jjObjects[explosionID].state = STATE::EXPLODE;
  
	destroyTileAt(jjObjects[bombID].xPos, jjObjects[bombID].yPos, 256);
	for (int angle = 0; angle < 1024; angle += 32) {
		destroyTileAt(jjObjects[bombID].xPos + 10 + jjSin(angle) * 32, jjObjects[bombID].yPos + 10 + jjCos(angle) * 32, angle);
		destroyTileAt(jjObjects[bombID].xPos + 10 + jjSin(angle) * 64, jjObjects[bombID].yPos + 10 + jjCos(angle) * 64, angle);
	}
	
	jjPARTICLE@ particle = jjAddParticle(PARTICLE::STRING);
	if (particle !is null) {
		particle.xPos = jjObjects[bombID].xPos - 16;
		particle.yPos = jjObjects[bombID].yPos;
		particle.string.text = WildScreamsOfJoyAtExplosions[jjRandom()%8];
		particle.ySpeed = -3;		
	}
	
	jjDeleteObject(bombID);
}
 
/***Gameplay functions***/
void onMain() {
  for (int i = 0;  i < jjObjectCount; i++)
    if (jjObjects[i].isActive && jjObjects[i].creatorType == CREATOR::PLAYER) {
      //Create bomb
      if (jjObjects[i].eventID == OBJECT::TNT && jjObjects[i].state != STATE::EXPLODE) {
        jjDeleteObject(i);
        CreateBomb(i);
        continue;
      }
   
      //Destroy bomb
      if (jjObjects[i].eventID == OBJECT::APPLE && jjObjects[i].special == 11) {
        jjObjects[i].age++;
        if (jjObjects[i].age > cBombLifeTime)
          DestroyBomb(i);
        continue;
      }
    }
}
bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) {
	return MLLE::WeaponHook.drawAmmo(player, canvas);
}

void onReceive(jjSTREAM&in packet, int fromClientID) {
	MLLE::WeaponHook.processPacket(packet, fromClientID);
}