#pragma name "Draw Arrows To Players" const array teams = {TEAM::BLUE, TEAM::RED, TEAM::GREEN, TEAM::YELLOW}; const float PI = 3.1415927f; int CTFArrowTimer = 0; uint8 getTeamColor(TEAM::Color team) { switch (team) { case TEAM::BLUE: return 32; case TEAM::RED: return 24; case TEAM::GREEN: return 16; case TEAM::YELLOW: return 40; } return 24; } void onLevelLoad() { jjAnimSets[ANIM::FLAG].load(); } void onMain() { if (CTFArrowTimer > jjGameTicks + 280) CTFArrowTimer = jjGameTicks; if (CTFArrowTimer < jjGameTicks) { if (CTFArrowTimer + 64 >= jjGameTicks) { for (int i = 0; i < 32; i++) { jjPLAYER@ play = jjPlayers[i]; if (!play.isLocal && play.isActive && play.isInGame && !play.isSpectating) { int angle = int(atan2(play.yPos - jjLocalPlayers[0].yPos, play.xPos - jjLocalPlayers[0].xPos) * (512 / PI)); const float scale = 64.f / (112.f - jjSin((jjGameTicks - CTFArrowTimer) << 3) * 64.f); uint shift; switch (play.charCurr) { case CHAR::SPAZ: shift = 8; break; case CHAR::BIRD: shift = 16; break; case CHAR::LORI: shift = 24; break; default: shift = 0; } if (jjGameMode == GAME::CTF && play.team != jjLocalPlayers[0].team && (jjGameCustom == GAME::TB || jjGameCustom == GAME::TLRS)) jjDrawRotatedSprite(jjLocalPlayers[0].xPos + 32 * jjCos(angle), jjLocalPlayers[0].yPos + 32 * jjSin(angle), ANIM::FLAG, 0, 0, 970 - angle, scale, scale, SPRITE::PALSHIFT, getTeamColor(play.team) - 32, 1); else if (jjGameMode == GAME::BATTLE && jjGameCustom != GAME::RT && jjGameCustom != GAME::PEST) jjDrawRotatedSprite(jjLocalPlayers[0].xPos + 32 * jjCos(angle), jjLocalPlayers[0].yPos + 32 * jjSin(angle), ANIM::FLAG, 0, 0, 970 - angle, scale, scale, SPRITE::PALSHIFT, (play.fur >> shift) - 32, 1); else if (jjGameCustom == GAME::PEST) { if (!jjLocalPlayers[0].isZombie && play.isZombie) jjDrawRotatedSprite(jjLocalPlayers[0].xPos + 32 * jjCos(angle), jjLocalPlayers[0].yPos + 32 * jjSin(angle), ANIM::FLAG, 0, 0, 970 - angle, scale, scale, SPRITE::PALSHIFT, (play.fur >> shift) - 32, 1); else if (jjLocalPlayers[0].isZombie && !play.isZombie) jjDrawRotatedSprite(jjLocalPlayers[0].xPos + 32 * jjCos(angle), jjLocalPlayers[0].yPos + 32 * jjSin(angle), ANIM::FLAG, 0, 0, 970 - angle, scale, scale, SPRITE::PALSHIFT, 248, 1); } } } } else { CTFArrowTimer = jjGameTicks + 210; } } }