Name | Author | Game Mode | Rating | |||||
---|---|---|---|---|---|---|---|---|
Spherical Coalesence | ThunDerDraGon | Capture the flag | N/A |
#pragma name "Starmageddon v1.0"
#pragma require "Starmageddon_bullet.png"
#pragma require "Starmageddon_explosion.png"
#pragma require "Starmageddon_gun.png"
#pragma require "Starmageddon_star1.png"
#pragma require "Starmageddon_star2.png"
#pragma require "Starmageddon_charge.png"
#pragma require "Starmageddon_charge.wav"
#pragma require "Starmageddon_fire.wav"
#pragma require "Starmageddon_Collapse.wav"
#pragma require "Starmageddon_explosion.wav"
#pragma require "Starmageddon_ammo.png"
namespace Starmageddon {
uint weaponID = 7;
enum weapPacket {Starma = 1};
void handlePresets () {
AATools::loadAssets("Starmageddon_bullet.png", 100, 100, 26);
AATools::loadAssets("Starmageddon_explosion.png", 118, 3600/20, 181);
AATools::loadAssets("Starmageddon_gun.png", 119,168, 62);
AATools::loadAssets("Starmageddon_star1.png", 99, 38, 30);
AATools::loadAssets("Starmageddon_star2.png", 98, 38, 30);
AATools::loadAssets("Starmageddon_charge.png", 97, 52, 26);
AATools::loadAssets("Starmageddon_ammo.png", 96, 26, 36);
AATools::loadParticlePresets();
jjSampleLoad(SOUND::XLIZARD_LIZ4, "Starmageddon_charge.wav");
jjSampleLoad(SOUND::XLIZARD_LIZ6, "Starmageddon_fire.wav");
jjSampleLoad(SOUND::XTURTLE_BITE3, "Starmageddon_Collapse.wav");
jjSampleLoad(SOUND::XTURTLE_HIDE, "Starmageddon_explosion.wav");
jjWeapons[weaponID].style = WEAPON::MISSILE;
jjWeapons[weaponID].defaultSample = false;
jjWeapons[weaponID].spread = SPREAD::NORMAL;
jjWeapons[weaponID].maximum = 2;
for (int i=0; i < 2; i++) {
if (i == 1 && weaponID == 7) break;
jjOBJ@ preset = jjObjectPresets[AATools::weaponToObject(weaponID)+i*8];
preset.behavior = Starmageddon();
preset.determineCurAnim(ANIM::CUSTOM[96], 0, true);
preset.special = 0;
}
jjObjectPresets[AATools::ammoType(weaponID)].behavior = Starmageddon_Ammo();
jjObjectPresets[OBJECT::APPLE].playerHandling = HANDLING::PLAYERBULLET;
jjObjectPresets[OBJECT::APPLE].bulletHandling = HANDLING::IGNOREBULLET;
jjObjectPresets[OBJECT::APPLE].isTarget = jjObjectPresets[OBJECT::APPLE].isFreezable =
jjObjectPresets[OBJECT::APPLE].isBlastable = false;
jjObjectPresets[OBJECT::APPLE].determineCurAnim(ANIM::CUSTOM[100], 0, true);
jjObjectPresets[OBJECT::APPLE].determineCurFrame();
jjObjectPresets[OBJECT::APPLE].animSpeed = 3;
jjObjectPresets[OBJECT::APPLE].behavior = Starmageddon_GigaBlast();
}
class Starmageddon_Ammo : jjBEHAVIORINTERFACE {
void onBehave(jjOBJ@ obj) {
obj.behave(BEHAVIOR::PICKUP, false);
obj.state = STATE::FLOATFALL;
obj.xSpeed = obj.ySpeed = 0;
}
void onDraw(jjOBJ@ obj) {
jjDrawResizedSprite(obj.xPos + 7, obj.yPos, ANIM::CUSTOM[119], 0, 7,
0.5+((jjGameTicks%150)/220.f),
0.5+((jjGameTicks%150)/220.f),
SPRITE::BLEND_NORMAL, 150 - ((jjGameTicks%150)));
jjDrawResizedSprite(obj.xPos + 7, obj.yPos, ANIM::CUSTOM[119], 0, 7, 0.5, 0.5, SPRITE::NORMAL);
}
}
int starmaCooldown, lastFastfire;
class Starmageddon : jjBEHAVIORINTERFACE {
void onBehave(jjOBJ@ obj) {
jjPLAYER@ play = jjPlayers[obj.creatorID];
if (obj.age == 0) {
jjSample(obj.xPos, obj.yPos, SOUND::XLIZARD_LIZ4);
lastFastfire = play.fastfire;
}
obj.lightType = LIGHT::NONE;
obj.xPos = play.xPos;
obj.yPos = play.yPos;
obj.counter++;
play.fastfire = 3000;
play.currWeapon = weaponID;
if (!play.keyFire || (play.curAnim - jjAnimSets[play.setID].firstAnim) == RABBIT::ROLLING
|| (play.curAnim - jjAnimSets[play.setID].firstAnim) == RABBIT::FALLBUTTSTOMP) {
play.fastfire = lastFastfire;
play.ammo[weaponID] = play.ammo[weaponID] + 1;
obj.delete();
} else {
obj.age++;
}
if (obj.age == 70*3) {
jjSample(obj.xPos, obj.yPos, SOUND::XLIZARD_LIZ6);
play.xSpeed = -33*play.direction;
obj.age = 0;
if (play.isLocal) {
jjOBJ@ gigablast = jjObjects[jjAddObject(OBJECT::APPLE, obj.xPos, obj.yPos, obj.creatorID, CREATOR::PLAYER)];
gigablast.direction = play.direction;
jjSTREAM packet;
packet.push(uint8(Starma));
packet.push(play.playerID);
packet.push(play.direction);
packet.push(obj.xPos);
packet.push(obj.yPos);
jjSendPacket(packet);
}
play.fastfire = 35;
if (play.isLocal) {
starmaCooldown = 70*10;
}
obj.delete();
}
}
void onDraw(jjOBJ@ obj) {
jjPLAYER@ play = jjPlayers[obj.creatorID];
jjDrawResizedSprite(play.xPos-(1 + jjRandom()%3)/2, play.yPos+5-(1 + jjRandom()%3)/2, ANIM::CUSTOM[119], 0, (obj.age < 9*8) ? int((obj.age%(8*9))/9) : 7,
(play.direction > 0) ? 0.73 : -0.73, 0.73, SPRITE::SINGLEHUE, obj.counter, 1);
jjDrawResizedSprite(play.xPos-(1 + jjRandom()%3)/2, play.yPos+5-(1 + jjRandom()%3)/2, ANIM::CUSTOM[119], 0, (obj.age < 9*8) ? int((obj.age%(8*9))/9) : 7,
(play.direction > 0) ? 0.7 : -0.7, 0.7, SPRITE::NORMAL, 0, 1);
jjDrawResizedSprite(play.xPos, play.yPos-50, ANIM::CUSTOM[97], 0, obj.age/11, 1, 1, SPRITE::NORMAL, 0, 1);
}
}
class Starmageddon_GigaBlast : jjBEHAVIORINTERFACE {
void onBehave(jjOBJ@ obj) {
obj.counter++;
if (obj.state == STATE::START) {
obj.var[6] = 16;
obj.state = STATE::FLY;
} else if (obj.state == STATE::FLY) {
obj.xPos += 16*obj.direction;
obj.yPos = obj.yOrg;
obj.frameID = int((obj.counter%(20*6))/6);
for (int i=0; i < 10; i++) {
jjPARTICLE@ particle = jjAddParticle(PARTICLE::SPARK);
if (particle !is null) {
particle.xPos = obj.xPos-6+(jjRandom()%12);
particle.yPos = obj.yPos-6+(jjRandom()%12);
particle.ySpeed = -0.3;
particle.xSpeed = 2*obj.direction;
int color = 8*8+(jjRandom()%6)*8;
particle.spark.color = color;
particle.spark.colorStop = color+8;
}
}
jjPLAYER@ target = jjPlayers[obj.findNearestPlayer(30000)];
if (obj.counter == 150 || jjMaskedPixel(int(obj.xPos), int(obj.yPos)) || (target.isEnemy(jjPlayers[obj.creatorID]) && target.isInGame)) {
obj.state = STATE::WAIT;
obj.counter = 0;
obj.lightType = LIGHT::BRIGHT;
jjSamplePriority(SOUND::XTURTLE_BITE3);
}
} else if (obj.state == STATE::WAIT) {
obj.light = 40 - obj.counter/4;
if (obj.counter%2 == 1 && obj.counter < 95) {
jjOBJ@ star = jjObjects[jjAddObject(OBJECT::ORANGE,
obj.xPos - 36*7*jjSin(jjRandom()%1024),
obj.yPos - 36*7*jjCos(jjRandom()%1024),
obj.creatorID, CREATOR::PLAYER)];
star.var[0] = int(atan2(star.xOrg - obj.xPos, star.yOrg - obj.yPos)*512/3.1415926f);
star.xSpeed = -(5+jjRandom()%2)*jjSin(star.var[0]);
star.ySpeed = -(5+jjRandom()%2)*jjCos(star.var[0]);
star.determineCurAnim(ANIM::CUSTOM[98+ jjRandom()%2], 0, true);
star.counterEnd = 225;
star.lightType = LIGHT::BRIGHT;
star.light = 8;
star.doesHurt = 1;
star.playerHandling = HANDLING::PARTICLE;
}
if (jjPlayers[obj.creatorID].isEnemy(p) && AATools::playerDistanceToObject(p ,obj) < 350) {
int angle = int(atan2(p.xPos - obj.xPos, p.yPos - obj.yPos)*512/3.1415926f);
p.xSpeed = -8*jjSin(angle);
p.ySpeed = -8*jjCos(angle);
p.buttstomp = 122;
}
if (obj.counter == 129) {
obj.state = STATE::EXPLODE;
obj.counter = 0;
jjSamplePriority(SOUND::XTURTLE_HIDE);
for (int i=0; i < 32; i++) {
jjPLAYER@ target = jjPlayers[i];
if (AATools::playerDistanceToObject(target, obj) < 250 && jjIsServer && target.isInGame && target.isEnemy(jjPlayers[obj.creatorID]))
target.hurt(7, (jjGameState == GAME::STARTED || jjGameState == GAME::OVERTIME) ? true : false, jjPlayers[obj.creatorID]);
}
obj.blast(180000, true);
}
} else if (obj.state == STATE::EXPLODE) {
if (obj.counter < 20) {
jjOBJ@ star = jjObjects[jjAddObject(OBJECT::ORANGE, obj.xPos, obj.yPos, obj.creatorID, CREATOR::PLAYER)];
uint angle = jjRandom()%1024;
star.xSpeed = -(12+jjRandom()%2)*jjSin(angle);
star.ySpeed = -(12+jjRandom()%2)*jjCos(angle);
star.determineCurAnim(ANIM::CUSTOM[98+ jjRandom()%2], 0, true);
star.counterEnd = 215;
star.lightType = LIGHT::BRIGHT;
star.light = 8;
star.doesHurt = 1;
star.playerHandling = HANDLING::PARTICLE;
}
obj.lightType = LIGHT::RING2;
obj.light += 3;
if (obj.counter < 40) {
if (obj.counter%2 == 0)
p.cameraFreeze(p.cameraX -2 + (jjRandom()%5), p.cameraY -2 + (jjRandom()%5), false, true);
else
p.cameraUnfreeze(true);
}
if (obj.counter > 20*3-3) {
obj.delete();
}
}
}
void onDraw(jjOBJ@ obj) {
if (obj.state == STATE::FLY)
for (int i=0; i < 5; i++)
jjDrawResizedSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, (obj.direction > 0) ? float((1 + 0.1*i)) : float(-(1 + 0.1*i)), float((1+0.1*i))
, SPRITE::NEONGLOW, i, 3);
else if (obj.state == STATE::WAIT) {
for (int i=0; i < 5; i++) {
float size = float((7.5 + 0.1*i)) - (obj.counter%130)/30.f;
jjDrawRotatedSprite(obj.xPos, obj.yPos, ANIM::AMMO, 77, 6, int((obj.counter*14 + i*100)*jjSin((2*i+1)*(1024/4))),
size, size, SPRITE::NEONGLOW, i, 3);
}
} if (obj.state == STATE::EXPLODE) {
jjDrawResizedSprite(obj.xPos, obj.yPos, ANIM::CUSTOM[118], 0, int((obj.counter%(20*3))/3),
2, 2, SPRITE::NORMAL, 1, 3);
}
}
}
void drawAmmo(jjPLAYER@ play, jjCANVAS@ hud) {
if (!play.noFire) {
hud.drawRotatedSprite(748, 570, ANIM::CUSTOM[119], 0, 7, 1, -0.6, 0.6, SPRITE::NORMAL, 0);
hud.drawString(691, 585, play.ammo[weaponID] + "/2", STRING::SMALL);
if (starmaCooldown > 0)
hud.drawString(650, 567, "||CD: " + int(starmaCooldown/70), STRING::SMALL);
}
}
void handleInput(jjPLAYER@ play) {
if (starmaCooldown > 0 && play.currWeapon == weaponID) {
play.keyFire = false;
}
if (play.keyFire && play.currWeapon == weaponID)
play.keyUp = false;
}
void handleCooldown() {
if (starmaCooldown > 0)
starmaCooldown--;
}
void handlePacket(jjSTREAM packet, int clientID) {
uint8 type;
int8 playerID, direction;
float xPos, yPos;
packet.pop(type);
packet.pop(playerID);
packet.pop(direction);
packet.pop(xPos);
packet.pop(yPos);
jjPLAYER@ play = jjPlayers[playerID];
if (type == uint8(Starma)) {
if (!jjIsServer && p.playerID != playerID) {
jjOBJ@ gigablast = jjObjects[jjAddObject(OBJECT::APPLE, xPos, yPos, play.playerID, CREATOR::PLAYER)];
gigablast.direction = direction;
}
if (jjIsServer) {
jjSTREAM packet1;
packet1.push(uint8(Starma));
packet1.push(playerID);
packet1.push(direction);
packet1.push(xPos);
packet1.push(yPos);
jjSendPacket(packet1);
jjOBJ@ gigablast = jjObjects[jjAddObject(OBJECT::APPLE, xPos, yPos, play.playerID, CREATOR::PLAYER)];
gigablast.direction = direction;
}
}
}
}
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.