Name | Author | Game Mode | Rating | |||||
---|---|---|---|---|---|---|---|---|
Hangin' on Ledges | DennisKainz | Mutator | N/A |
//With this mutator, Jazz and Spaz will hang on ledges just like Earthworm Jim and Commander Keen (and many other videogame heroes).
array<uint8> hang = {0, 0, 0, 0}; //Whether the player is hanging on a ledge or not. There are four array values for the sake of splitscreeners.
array<bool> hangLeft = {false, false, false, false}; //Whether the ledge is on the left...
array<bool> hangRight = {false, false, false, false}; //...or on the right.
void onMain()
{
for (uint i = 0; i < 3; i++)
{
jjPLAYER@ player = jjLocalPlayers[i]; //Defines which player undergoes the scripting in splitscreen mode.
if (player.isLocal && !jjIsTSF) //There are no ledge climbing animations in 1.24, so you have to be in 1.23 to use this mutator.
{
if (player.ySpeed > 0 && hangLeft[i] == false && hangRight[i] == false) //The player is falling and isn't currently hanging on any ledge.
{
if (!jjMaskedHLine(player.xPos - 40, 40, player.yPos - 13) && !jjMaskedHLine(player.xPos - 40, 40, player.yPos - 29) && jjMaskedVLine(player.xPos - 13, player.yPos - 13, 10) && player.direction < 0) //Checks for a wall right in front of you and for a free space above. It covers an area of 32x16 so you don't hang on short ledges and get stuck. You can only hang on ledges that have a straight terrain on top (or a slope on the opposite side like tiles 753 and 754 in Diamondus).
{
hang[i] = 1;
hangLeft[i] = true; //Start hanging.
}
if (!jjMaskedHLine(player.xPos, 40, player.yPos - 13) && !jjMaskedHLine(player.xPos, 40, player.yPos - 29) && jjMaskedVLine(player.xPos + 13, player.yPos - 13, 10) && player.direction > 0)
{
hang[i] = 1;
hangRight[i] = true;
}
}
if (hang[i] > 0) //The player is currently hanging.
{
player.invisibility = true; //Hide the actual sprite of the player since those can't be determined.
hang[i] = hang[i] + 1; //How long the player has been hanging.
if (hangLeft[i] == true)
{
player.xPos = player.xPos - 1; //Move the player towards the top of the ledge.
if (player.charCurr == CHAR::JAZZ) //Whether the player is playing as Jazz...
jjDrawSprite(player.xPos, player.yPos, ANIM::JAZZ, 20, 0 + (hang[i] / 3), -1, SPRITE::PLAYER, i); //The unused sprite of Jazz hanging on a ledge (now used) in the color of the specified player.
if (player.charCurr == CHAR::SPAZ) //...or as Spaz.
jjDrawSprite(player.xPos, player.yPos, ANIM::SPAZ, 20, 0 + (hang[i] / 3), -1, SPRITE::PLAYER, i);
}
if (hangRight[i] == true)
{
player.xPos = player.xPos + 1;
if (player.charCurr == CHAR::JAZZ)
jjDrawSprite(player.xPos, player.yPos, ANIM::JAZZ, 20, 0 + (hang[i] / 3), 1, SPRITE::PLAYER, i);
if (player.charCurr == CHAR::SPAZ)
jjDrawSprite(player.xPos, player.yPos, ANIM::SPAZ, 20, 0 + (hang[i] / 3), 1, SPRITE::PLAYER, i);
}
player.yPos = player.yPos - 1;
player.xSpeed = 0; //Keep the player in place, so he doesn't get stuck in walls.
player.ySpeed = 0;
}
if (hang[i] > 20 && !jjMaskedHLine(player.xPos - 13, 26, player.yPos + 21)) //The player reached the top of the ledge
{
player.invisibility = false; //Restore the actual sprite of the character.
hang[i] = 0; //Stop hanging.
hangLeft[i] = false;
hangRight[i] = false;
}
}
}
}
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.