Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Super Mario 3D World moveset
- Allows player to crawl and long jump.
- sm3dwMove is api name. overwriteSpinJump will overwrite Spin Jump with Long Jump
- ]]
- local footContact = false;
- local isBannedCharacter = false;
- local isInSomething = false;
- local allowLongJump = false;
- local isDoingBannedStuff = false;
- local allowCrawl = false;
- local isHoldingSomething = false;
- local playeranim = API.load("playerAnim");
- local inputs = API.load("inputs2");
- local sm3dwMove = {}
- sm3dwMove.overwriteSpinJump = false;
- if sm3dwMove.overwriteSpinJump then
- inputs.lock(1, "altjump")
- end
- function sm3dwMove.onInitAPI()
- registerEvent(sm3dwMove, "onTick", "onTick")
- registerEvent(sm3dwMove, "onStart", "onStart")
- end
- local function memRecognitionFunction()
- currentPowerUp = player:mem(0x112, FIELD_WORD);
- inGroundNow = player:mem(0x146, FIELD_BOOL);
- inSlopeNow = player:mem(0x48, FIELD_BOOL);
- inStandNPC = player:mem(0x176, FIELD_BOOL);
- pressedAltJump = player.altJumpKeyPressing;
- pressedJump = player.jumpKeyPressing;
- pressedRun = player.runKeyPressing;
- isInVine = player:mem(0x40, FIELD_BOOL);
- isInMount = player:mem(0x108, FIELD_BOOL);
- isInWater = player:mem(0x44, FIELD_BOOL);
- spriteHeld = player:mem(0x154, FIELD_WORD);
- characterId = player:mem(0xF0, FIELD_WORD);
- pressedDown = player.downKeyPressing
- isLeft = player.mem(0x114, FIELD_WORD) < 0;
- isStatue = player.mem(0x4A, FIELD_BOOL)
- isInRainbowShell = player:mem(0x44, FIELD_BOOL)
- end
- local function memFusions()
- if not inSlopeNow and
- not inGroundNow and
- not inStandNPC then
- footContact = false;
- else
- footContact = true;
- end
- if characterId == 1 or
- characterId == 2 then
- isBannedCharacter = false
- else
- isBannedCharacter = true
- end
- if spriteHeld >= 1 then
- isHoldingSomething = true;
- else
- isHoldingSomething = false;
- end
- if isInVine or
- isInMount or
- isInWater or
- isInRainbowShell then
- isInSomething = true;
- else
- isInSomething = false
- end
- end
- local function doingBannedStuff()
- if not footContact or
- isBannedCharacter or
- isInSomething or
- isHoldingSomething then
- isDoingBannedStuff = true;
- else
- isDoingBannedStuff = false;
- end
- end
- local longJumpLeftAnim = playeranim.Anim({-2, -24, -24, -24, -24}, 5)
- local longJumpRightAnim = playeranim.Anim({2, 24, 24, 24, 24}, 5)
- local animationTimer = 0
- local animTimerLimit = 15
- local function longJump()
- if overwriteSpinJump and
- inputs.state(1, "altjump") == inputs.PRESS and
- not isDoingBannedStuff then
- if isLeft then
- longJumpLeftAnim:play(player);
- Audio.playSFX(getSMBXPath().."\\sound\\player-jump.ogg");
- player.speedX = -40
- player.speedY = -10
- else
- longJumpRightAnim:play(player);
- Audio.playSFX(getSMBXPath().."\\sound\\player-jump.ogg");
- player.speedX = 40
- player.speedY = -10
- end
- elseif not overwriteSpinJump and
- (inputs.state(1, "jump") == inputs.PRESS and inputs.state(1, "run") == inputs.HOLD) and
- not isDoingBannedStuff then
- if isLeft then
- longJumpLeftAnim:play(player);
- Audio.playSFX(getSMBXPath().."\\sound\\player-jump.ogg");
- player.speedX = -40
- player.speedY = -10
- else
- longJumpRightAnim:play(player);
- Audio.playSFX(getSMBXPath().."\\sound\\player-jump.ogg");
- player.speedX = 40
- player.speedY = -10
- end
- end
- end
- local function animTimeReload()
- if not isDoingBannedStuff then
- animationTimer = animationTimer + 1;
- else
- animationTimer = 0
- end
- end
- local function animation()
- if animationTimer >= animTimerLimit or
- usingBannedPowerUps or
- isInSomething or
- isHoldingSomething or
- footContact then
- longJumpLeftAnim:stop(player);
- longJumpRightAnim:stop(player);
- end
- end
- local function crouchwalk()
- if player.downKeyPressing and
- not doingBannedStuff then
- if player.rightKeyPressing then
- player.speedX = 5
- elseif player.leftKeyPressing then
- player.speedX = -5
- end
- end
- end
- function sm3dwMove.onTick()
- memRecognitionFunction();
- memFusions();
- doingBannedStuff();
- animation();
- animTimeReload();
- longJump();
- crouchwalk();
- end
- return sm3dwMove;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement