Name | Author | Game Mode | Rating | |||||
---|---|---|---|---|---|---|---|---|
Blood Libel | Violet CLM | Battle | 8.5 |
#pragma require "SpikeBomb.asc"
#pragma require "SpikeBomb.j2a"
#include "MLLE-Weapons.asc"
namespace SpikeBomb {
const float BottomOfLevel = jjLayerHeight[4] * 32;
class Weapon : MLLEWeapons::WeaponInterface {
Weapon() {
super(
regularObjectTemplate: MLLEWeapons::ObjectTemplate(
var: array<int> = {5, 1},
killAnim: jjAnimSets[ANIM::AMMO].firstAnim + 80,
counterEnd: 255, //default
playerHandling: HANDLING::PARTICLE
),
powerupObjectTemplate: MLLEWeapons::ObjectTemplate(
var: array<int> = {7, 1},
curAnim: 1,
animSpeed: 2,
killAnim: jjAnimSets[ANIM::AMMO].firstAnim + 80,
counterEnd: 255,
playerHandling: HANDLING::PARTICLE
),
animSetFilename: "SpikeBomb.j2a",
pickupAnimation: 0,
poweredUpPickupAnimation: 1,
//powerupAnimation: 6,
//ammoCrateAnimation: 7,
style: WEAPON::MISSILE,
behavior: MLLEWeapons::behaviorFunction(DetermineBehavior),
apply: MLLEWeapons::applyFunction(CheckOptions)
);
}
void DetermineBehavior(jjOBJ@ obj, bool powerup) {
if (obj.creatorType != CREATOR::PLAYER || jjPlayers[obj.creatorID].isLocal)
jjSample(obj.xPos, obj.yPos, SOUND::COMMON_FOEW2, 0, 0);
if (obj.creatorType == CREATOR::PLAYER && jjPlayers[obj.creatorID].isLocal)
obj.var[2] = 0; //no shadow for local spikes
obj.eventID = OBJECT::TNT;
obj.behavior = Behavior;
}
bool CheckOptions(uint, se::WeaponHook@, jjSTREAM@ parameter) {
PowerupObjectTemplate.CurAnim = PoweredUpPickupAnimation;
if (parameter !is null && parameter.getSize() >= 11) {
int pi; bool pb;
parameter.pop(pb); RegularObjectTemplate.Var[1] = pb ? 1 : 0; //diagonal
parameter.pop(pb); PowerupObjectTemplate.Var[1] = pb ? 1 : 0;
parameter.pop(pi); RegularObjectTemplate.CounterEnd = pi; //lifetime
parameter.pop(pi); PowerupObjectTemplate.CounterEnd = pi;
parameter.pop(pb); RegularObjectTemplate.Var[2] = PowerupObjectTemplate.Var[2] = pb ? 1 : 0; //shadow
}
return true;
}
}
void Behavior(jjOBJ@ obj) {
obj.behave(BEHAVIOR::TNT);
if (obj.yPos < BottomOfLevel && !jjMaskedHLine(int(obj.xPos - 12), 24, int(obj.yPos + 8))) { //falling
obj.yPos += obj.var[0];
if (obj.var[2] != 0) { //shadow
const int floor = jjMaskedTopVLine(int(obj.xPos), int(obj.yPos), 9000);
if (floor <= 9000)
jjDrawResizedSpriteFromCurFrame(obj.xPos, obj.yPos + floor, obj.curFrame, 1.8, 0.7, SPRITE::SINGLECOLOR, 24 | (jjGameTicks & 7));
}
if (obj.counter > int(obj.counterEnd - 2))
obj.counter = obj.counterEnd - 2; //don't explode yet
}
if (obj.state == STATE::EXPLODE) {
if (obj.counter == 24) {
jjSample(obj.xPos, obj.yPos, SOUND::COMMON_PISTOL1, 0, 0);
for (int i = -8; i <= 8; i += 8) {
for (int j = -8; j <= 8; j += 8) {
if (obj.var[1] == 1) { //allow diagonals
if (i == 0 && j == 0)
continue;
} else { //only orthogonals
if ((i == 0) == (j == 0))
continue;
}
int id = jjAddObject(OBJECT::BULLET, obj.xPos, obj.yPos, obj.creatorID, CREATOR::PLAYER, BEHAVIOR::PEPPERBULLET);
if (id != 0) {
jjOBJ@ burst = jjObjects[id];
burst.animSpeed = obj.animSpeed;
burst.direction = 1;
burst.determineCurAnim(ANIM::AMMO, 16);
burst.determineCurFrame();
burst.behavior = Spike;
burst.playerHandling = HANDLING::PLAYERBULLET;
burst.var[3] = 8;
burst.xSpeed = j;
burst.ySpeed = i;
burst.var[0] = int(atan2(-burst.ySpeed, burst.xSpeed) * (512.f * 0.318309886142228f));
burst.var[6] = obj.var[6];
burst.xAcc = burst.yAcc = 0;
burst.lightType = LIGHT::POINT2;
burst.light = 1;
burst.isBlastable = false;
}
}
}
}
}
}
void Spike(jjOBJ@ obj) {
obj.behave(BEHAVIOR::PEPPERBULLET, obj.state == STATE::EXPLODE);
if (obj.state != STATE::EXPLODE)
jjDrawRotatedSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.var[0], 0.75, 0.75);
}
}
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.