Name | Author | Game Mode | Rating | |||||
---|---|---|---|---|---|---|---|---|
Spherical Coalesence | ThunDerDraGon | Capture the flag | N/A |
#pragma name "Starboard v1.0"
#pragma require "Starboard_flight.wav"
#pragma require "Starboard_explosion.wav"
#pragma require "Starboard.png"
#pragma require "starboard_explosion.png"
namespace Starboard {
int starID;
enum weapPacket {starboard = 2};
void handleInput(jjPLAYER@ play) {
jjOBJ@ star = jjObjects[starID];
if (star.creatorID == uint(play.playerID) && star.isActive && star.state == STATE::FLOAT) {
if (play.keyUp)
play.keyFire = false;
play.keyJump = false;
} else starID = 0;
}
void handlePresets () {
jjSampleLoad(SOUND::XLIZARD_LIZ1, "Starboard_flight.wav");
jjSampleLoad(SOUND::XLIZARD_LIZ2, "Starboard_explosion.wav");
AATools::loadAssets("starboard_explosion.png", 101, 84, 150);
AATools::loadAssets("Starboard.png", 49, 42, 32);
jjObjectPresets[OBJECT::FASTFEET].scriptedCollisions = true;
jjObjectPresets[OBJECT::FASTFEET].behavior = Star();
jjObjectPresets[OBJECT::FASTFEET].determineCurAnim(ANIM::CUSTOM[49], 0);
jjOBJ@ preset = jjObjectPresets[OBJECT::WEENIE];
preset.behavior = Starboard();
preset.isBlastable = preset.isFreezable = false;
preset.playerHandling = HANDLING::PLAYERBULLET;
preset.bulletHandling = HANDLING::IGNOREBULLET;
preset.animSpeed = 3;
preset.determineCurAnim(ANIM::CUSTOM[49], 0);
}
class Star : jjBEHAVIORINTERFACE {
void onBehave(jjOBJ@ obj) {
obj.behave(BEHAVIOR::PICKUP);
}
bool onObjectHit(jjOBJ@ obj, jjOBJ@, jjPLAYER@ player, int) {
jjAddObject(OBJECT::WEENIE, obj.xPos, obj.yPos, player.playerID, CREATOR::PLAYER);
obj.behavior = BEHAVIOR::EXPLOSION2;
obj.scriptedCollisions = false;
obj.frameID = 0;
if (jjIsServer && player.isLocal) {
jjSTREAM packet;
packet.push(uint8(starboard));
packet.push(player.playerID);
jjSendPacket(packet);
}
return true;
}
}
void handlePacket(jjSTREAM packet, int clientID) {
uint8 type;
int8 playerID;
packet.pop(type);
packet.pop(playerID);
jjPLAYER@ play = jjPlayers[playerID];
if (type == uint8(starboard)) {
jjAddObject(OBJECT::WEENIE, play.xPos, play.yPos, play.playerID, CREATOR::PLAYER);
}
}
class Starboard : jjBEHAVIORINTERFACE {
void onBehave(jjOBJ@ obj) {
jjPLAYER@ play = jjPlayers[obj.creatorID];
obj.counter++;
if (obj.state == STATE::START) {
if (play.isLocal)
starID = obj.objectID;
for (int i = 1; i < jjObjectCount; i++) {
jjOBJ@ o = jjObjects[i];
if (o.isActive && o.eventID == obj.eventID && obj.creatorID == o.creatorID && o.objectID != obj.objectID)
o.delete();
}
jjSample(obj.xPos, obj.yPos, SOUND::XLIZARD_LIZ1);
obj.var[6] = 16;
obj.var[0] = (1024/-8*play.direction + 1024*10);
obj.xSpeed = obj.ySpeed = 0;
obj.xPos = play.xPos;
obj.yPos = play.yPos+10;
obj.state = STATE::FLOAT;
play.ySpeed = 0;
play.buttstomp = 122;
AATools::addAfterImage(obj);
} else if (obj.state == STATE::FLOAT) {
if (play.isLocal) {
play.direction = obj.direction;
play.xSpeed = play.ySpeed = play.xAcc = play.yAcc = 0;
obj.frameID = int((jjGameTicks%(3*7))/7);
obj.direction = (obj.xSpeed >= 0) ? 1 : -1;
obj.beSolid(false);
if (!jjMaskedHLine(int(play.xPos-15), 30, (obj.ySpeed >= 0) ? int(play.yPos+45) : int(play.yPos+1)))
obj.yPos += obj.ySpeed;
obj.ySpeed = -10*jjCos(obj.var[0]*2);
if (!jjMaskedVLine(int(play.xPos+21*obj.direction), int(play.yPos+15), 20))
obj.xPos += obj.xSpeed;
if (jjMaskedVLine(int(play.xPos+21*obj.direction), int(play.yPos+15), 20)
&& jjMaskedHLine(int(play.xPos-15), 30, int(play.yPos+45)) && !jjMaskedHLine(int(play.xPos-15), 30, int(play.yPos+1)))
obj.yPos -= 4;
obj.xSpeed = -10*jjSin(obj.var[0]*2);
if (play.platform == obj.objectID) {
int angle = (obj.var[0]*2)%1024;
if (play.keyUp && jjCos(angle) != 1 && (!play.keyLeft && !play.keyRight))
obj.var[0] = (1024-(angle) > 1024/2) ? obj.var[0]-8 : obj.var[0]+8;
if (play.keyDown && jjCos(angle) != -1 && (!play.keyLeft && !play.keyRight))
obj.var[0] = (1024-(angle) > 1024/2) ? obj.var[0]+8 : obj.var[0]-8;
if (play.keyRight && jjSin(angle) != -1 && (!play.keyUp && !play.keyDown))
obj.var[0] = (angle > 256 && angle < 768) ? obj.var[0]+8 : obj.var[0]-8;
if (play.keyLeft && jjSin(angle) != 1 && (!play.keyUp && !play.keyDown))
obj.var[0] = (angle > 256 && angle < 768) ? obj.var[0]-8 : obj.var[0]+8;
if (play.keyUp && play.keyRight && angle != 896)
obj.var[0] = (angle < 896 && angle > 384) ? obj.var[0]+8 : obj.var[0]-8;
if (play.keyDown && play.keyLeft && angle%1024 != 384)
obj.var[0] = (angle < 896 && angle > 384) ? obj.var[0]-8 : obj.var[0]+8;
if (play.keyDown && play.keyRight && angle != 640)
obj.var[0] = (angle < 640 && angle > 128) ? obj.var[0]+8 : obj.var[0]-8;
if (play.keyUp && play.keyLeft && angle != 128)
obj.var[0] = (angle < 640 && angle > 128) ? obj.var[0]-8 : obj.var[0]+8;
}
play.xPos = obj.xPos-2.5*play.direction;
play.yPos = obj.yPos-20;
} else {
obj.xPos = play.xPos+3*play.direction;
obj.yPos = play.yPos+18;
}
for (int i=0; i < 6; i++) {
jjPARTICLE@ particle = jjAddParticle(PARTICLE::FIRE);
if (particle !is null) {
particle.xPos = obj.xPos-6+(jjRandom()%12);
particle.yPos = obj.yPos-6+(jjRandom()%12);
particle.fire.size = jjRandom()%4;
int color = 8+(jjRandom()%6)*8;
particle.fire.color = color;
particle.fire.colorStop = color+8;
}
}
if (obj.counter%70 == 69)
jjSample(obj.xPos, obj.yPos, SOUND::XLIZARD_LIZ1);
if (obj.counter > 8*70 || play.health == 0 || play.warpID > 0 || jjEventGet(int(obj.xPos/32), int(obj.yPos/32)) == AREA::FLYOFF
|| jjEventGet(int(obj.xPos/32), int(obj.yPos/32)) == AREA::SUCKERTUBE) {
obj.state = STATE::EXPLODE;
obj.counter = 0;
jjSample(obj.xPos, obj.yPos, SOUND::XLIZARD_LIZ2);
}
} else if (obj.state == STATE::EXPLODE) {
if (obj.counter == 1) {
obj.yPos -= 65;
play.yPos += 5;
}
obj.bePlatform(0, 0);
obj.determineCurAnim(ANIM::CUSTOM[101], 0);
obj.frameID = int((obj.counter%(7*8))/8);
if (obj.counter == 56)
obj.delete();
}
}
void onDraw(jjOBJ@ obj) {
if (obj.state == STATE::FLOAT && jjPlayers[obj.creatorID].isLocal)
jjDrawString(obj.xPos - 6, obj.yPos + 28, "||||" + (9-obj.counter/60), STRING::SMALL);
obj.draw();
obj.determineCurFrame();
}
}
}
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.