Name | Author | Game Mode | Rating | |||||
---|---|---|---|---|---|---|---|---|
Threed Realms | Violet CLM | Single player | 9.7 | |||||
Gold Rush | Violet CLM | Mutator | N/A | |||||
Multiflag | Violet CLM | Mutator | 9.5 | |||||
Jazz of the Jungle | Violet CLM | Single player | 8.9 |
#pragma require "ArtificialArrow.asc"
namespace ArtificialArrow {
class SortableDistance {
float distance;
uint index;
SortableDistance(){}
SortableDistance(float d, uint i) { distance = d; index = i; }
int opCmp(const SortableDistance &in other) const {
return int(distance - other.distance);
}
}
int ArrowTimer = 0;
const uint ArrowSprite = jjAnimations[jjAnimSets[ANIM::FLAG]];
void DrawArrow(const array<int> &in targets, const jjPLAYER@ player, SPRITE::Mode spriteMode, uint8 spriteParam, int maxDistance = -1) {
if (targets.length != 0 && (targets.length & 1) == 0 && player !is null) {
if (ArrowTimer > jjGameTicks + 70*4)
ArrowTimer = jjGameTicks;
else if (ArrowTimer < jjGameTicks) {
if (ArrowTimer + 64 >= jjGameTicks) {
const int px = int(player.xPos), py = int(player.yPos);
array<SortableDistance> distances;
for (uint i = 0; i < targets.length; i += 2) {
const float deltaX = abs(px - targets[i]);
const float deltaY = abs(py - targets[i+1]);
distances.insertLast(SortableDistance(deltaX * deltaX + deltaY * deltaY, i));
}
int target = -1;
distances.sortAsc();
if (maxDistance < 0 || distances[0].distance > maxDistance)
target = distances[0].index;
if (target >= 0) {
const int angle = int(atan2(
py - targets[target+1],
targets[target] - px
) * -512.0 * 0.318309886142228);
const float scale = (112 - (jjSin((jjGameTicks - ArrowTimer) << 3) * -64)) / 128.f;
jjDrawRotatedSpriteFromCurFrame(
player.xPos + jjCos(angle) * 32, player.yPos + jjSin(angle) * 32,
ArrowSprite, 970 - angle, scale, scale, spriteMode,spriteParam, 4, 4, player.playerID
);
}
} else {
ArrowTimer = jjGameTicks + 70*3;
}
}
}
}
}
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.