I was going to upload a small mutator that allows players to grab ledges and lift themselves on them (as in Earthworm Jim and Commander Keen). However, there are a few problems...
Here's the script:
Code:
array hang = {0, 0, 0, 0};
array hangLeft = {false, false, false, false};
array hangRight = {false, false, false, false};
void onMain() {
for (uint i = 0; i < 3; i++) {
jjPLAYER@ player = jjLocalPlayers[i];
if (player.isLocal) {
if (player.ySpeed > 0 && hangLeft[i] == false && hangRight[i] == false)
{
if (!jjMaskedPixel(player.xPos - 16, player.yPos - 16) && jjMaskedVLine(player.xPos - 16, player.yPos - 14, 8) && player.direction < 0)
{
hang[i] = 1;
hangLeft[i] = true;
}
if (!jjMaskedPixel(player.xPos + 16, player.yPos - 16) && jjMaskedVLine(player.xPos + 16, player.yPos - 14, 8) && player.direction > 0)
{
hang[i] = 1;
hangRight[i] = true;
}
}
if (hang[i] > 0)
{
player.invisibility = true;
hang[i] = hang[i] + 1;
if (hangLeft[i] == true)
{
player.xPos = player.xPos - 0.875;
jjDrawSprite(player.xPos, player.yPos, ANIM::JAZZ, 20, 0 + (hang[i] / 3), -1, SPRITE::NORMAL, 0);
}
if (hangRight[i] == true)
{
player.xPos = player.xPos + 0.875;
jjDrawSprite(player.xPos, player.yPos, ANIM::JAZZ, 20, 0 + (hang[i] / 3), 1, SPRITE::NORMAL, 0);
}
player.yPos = player.yPos - 1;
player.xSpeed = 0;
player.ySpeed = 0;
}
if (hang[i] > 30 && !jjMaskedPixel(player.xPos, player.yPos + 22))
{
player.invisibility = false;
hang[i] = 0;
hangLeft[i] = false;
hangRight[i] = false;
}
}
}
}
For now, I only made it for Jazz.
I can't find a way to determine the animation of the player itself, so I had to make the player invisible and draw the sprite in front of him instead. This gives the player the default skin color while he's hanging, which is wrong. I need a way to determine the player's current animation, rather than drawing upon him.
Oh, right! There also is this problem with the RABBIT::Anim where I simply can't find the one corresponding to Jazz grabbing the ledge. I had to use the numeral value, which probably differs between 1.23 and 1.24.
__________________
Free will was a mistake.
- God
Last edited by DennisKainz; Jan 31, 2019 at 02:31 PM.
Reason: I found the way to use arrays for splitscreeners.
|