Name | Author | Game Mode | Rating | |||||
---|---|---|---|---|---|---|---|---|
Anniversary Bash 24 Battle | Jazz2Online | Battle | N/A | |||||
Acid Reign | cooba | Battle | 9.2 | |||||
Anniversary Bash 23 levels | Jazz2Online | Multiple | N/A | |||||
violetclm DOM Episodes I... | Violet CLM | Custom / Concept | 9 | |||||
street fight!!!!!!! | cooba | Battle | N/A | |||||
Custom Weapons... | Violet CLM | Other | 10 |
#pragma require "petrolBomb.asc"
#pragma require "petrolBomb.j2a"
#pragma offer "glass_shatter.wav"
#include "MLLE-Weapons.asc"
/**Petrol Bomb**/
/**Author: szmol96**/
namespace SzmolWeaponPack {
namespace PetrolBomb {
class PlayerX {
int prevClosest = 0;
int missileCounter = 0;
uint mCounterDelay = 0;
}
array<PlayerX> PlayersX(jjLocalPlayerCount);
array<int> closestPlayers(32); //needed even for non-local players
class Weapon : MLLEWeapons::WeaponInterface {
Weapon() {
super(
regularObjectTemplate: MLLEWeapons::ObjectTemplate(
xSpeed: 5,
ySpeed: -5,
curAnim: 0,
killAnim: jjAnimSets[ANIM::AMMO] + 77,
counterEnd: 255
),
sampleFilenames: array<string> = {"glass_shatter.wav"},
animSetFilename: "petrolBomb.j2a",
pickupAnimation: 3,
poweredUpPickupAnimation: 3,
style: WEAPON::MISSILE,
roundsPerPickup: 1,
generateSupplementalAnimations: false,
traits: (se::weapon_default_traits | se::weapon_causes_splash_damage | se::weapon_may_harm_user | se::weapon_melts_ice) & ~(se::weapon_has_powerup_monitors | se::weapon_has_distinct_powerup | se::weapon_has_ammo_crates),
onDrawAmmo: se::DrawingCallback(DrawAmmo),
onReceive: se::PacketCallback(DoBombPackets),
weaponHookRequired: true,
behavior: MLLEWeapons::behaviorFunction(DetermineBehavior)
);
}
uint getMaxDamage(bool) const override { return 2; }
bool DrawAmmo(jjPLAYER@ p, jjCANVAS@ canvas, const jjANIMATION@) const {
if (jjWeapons[p.currWeapon].maximum != -1 && jjWeapons[p.currWeapon].maximum <= 6) { //otherwise this would just look silly
for (int8 i = 0; i < p.ammo[WEAPON::CURRENT]; ++i)
canvas.drawSprite(jjSubscreenWidth - 80 + i * 14, jjSubscreenHeight - 16, SetID,0,1);
return true;
}
return false;
}
void DoBombPackets(jjSTREAM& packet, int clientID) const {
int16 posX;
int16 posY;
int32 playNum;
packet.pop(posX);
packet.pop(posY);
packet.pop(playNum);
addFlames(posX, posY, playNum, CREATOR::PLAYER, jjIsServer);
}
void sendBombPacket(int16 posX, int16 posY, int32 playNum) const {
jjSTREAM packet = ConstructPacket();
packet.push(posX);
packet.push(posY);
packet.push(playNum);
jjSendPacket(packet);
}
void addFlames(float x, float y, uint16 crID, CREATOR::Type crType, bool send) const {
for (uint dir = 0; dir < 10; ++dir) {
jjOBJ@ flame1 = jjObjects[jjAddObject(OBJECT::TOASTERBULLET, x, y, crID, crType, BEHAVIOR::INACTIVE)];
flame1.xSpeed = jjSin(102 * dir + 128) * 2;
flame1.ySpeed = jjCos(102 * dir + 128) * 2;
flame1.determineCurAnim(SetID, 1, true);
flame1.killAnim = flame1.determineCurAnim(SetID, 2, false);
flame1.playerHandling = HANDLING::PARTICLE; //will handle its own collision
flame1.lightType = LIGHT::NONE;
//flame1.var[6] = 16;
flame1.age = 0;
flame1.animSpeed = 1;
flame1.behavior = bombFlame;
flame1.freeze = 0;
flame1.state = STATE::FLY;
}
if (send)
sendBombPacket(int16(x),int16(y),crID);
}
void DetermineBehavior(jjOBJ@ obj, bool powerup) const { obj.behavior = jjVOIDFUNCOBJ(Behavior); obj.var[6] = 8; }
void Behavior(jjOBJ@ bomb) const {
if (bomb.state == STATE::START) {
bomb.xSpeed += bomb.var[7] / 98302.5; //1.5
if (bomb.creatorType == CREATOR::PLAYER)
bomb.ySpeed += jjPlayers[bomb.creatorID].ySpeed / 2.2;
jjSample(bomb.xPos, bomb.yPos, SOUND::COMMON_FOEW1, 63, 0);
bomb.state = STATE::FLOATFALL;
}
bomb.xPos += bomb.xSpeed;
bomb.yPos += bomb.ySpeed;
if (bomb.ySpeed < 8) bomb.ySpeed += 0.25;
if (bomb.state == STATE::EXPLODE || jjMaskedPixel(int(bomb.xPos + bomb.xSpeed), int(bomb.yPos + bomb.ySpeed))) {
if (bomb.creatorType != CREATOR::PLAYER || jjIsServer || jjGameConnection == GAME::LOCAL)
addFlames(bomb.xPos, bomb.yPos, bomb.creatorID, bomb.creatorType, bomb.creatorType == CREATOR::PLAYER);
if (SamplesLoaded[0])
jjSample(bomb.xPos, bomb.yPos, Samples[0]);
bomb.particlePixelExplosion(0);
bomb.delete();
}
if (++bomb.age % 3 == 1) bomb.frameID += 1;
bomb.determineCurFrame(true);
bomb.draw();
}
}
void bombFlame(jjOBJ@ flame) {
flame.xPos += flame.xSpeed;
flame.yPos += flame.ySpeed;
if (!jjMaskedPixel(int(flame.xPos + flame.xSpeed), int(flame.yPos + flame.ySpeed))) {
if (flame.ySpeed < 4) flame.ySpeed += 0.1;
} else {
if (flame.ySpeed < 0) {
flame.ySpeed = ((jjRandom() % 0.999));
} else {
flame.xSpeed = 0;
flame.ySpeed = 0;
}
}
if (jjGameTicks & 3 == 0) {
for (int lpid = 0; lpid < jjLocalPlayerCount; ++lpid) {
jjPLAYER@ lp = jjLocalPlayers[lpid];
if (flame.doesCollide(lp, false))
lp.hurt(1, false, flame.creatorType == CREATOR::PLAYER ? jjPlayers[flame.creatorID] : null);
}
if (flame.creatorType == CREATOR::PLAYER)
for (int objectID = jjObjectCount; --objectID != 0; ) {
jjOBJ@ obj = jjObjects[objectID];
if (obj.isTarget && obj.state != STATE::KILL && flame.doesCollide(obj, false)) {
flame.playerHandling = HANDLING::PLAYERBULLET;
flame.objectHit(obj, obj.playerHandling);
flame.state = STATE::EXPLODE;
break;
} else if (obj.behavior == BEHAVIOR::SPRING && flame.doesCollide(obj, false)) {
obj.freeze = 0;
obj.noHit = 1;
}
}
}
if (flame.age++ > int((jjRandom() % 750) + 650))
flame.state = STATE::EXPLODE;
if (flame.state == STATE::EXPLODE) {
flame.behavior = BEHAVIOR::EXPLOSION2;
flame.frameID = 0;
}
if (jjGameTicks % 5 == 0) flame.frameID += 1;
flame.determineCurFrame(true);
flame.draw();
}
}
}
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.