--Sonic Heroes-style jumping animation by Zarosguth, --Reusable, please give proper credit. --Whitelist of skins that get the Heroes-style jumping animation: local whitelist = {"sonic","tails","knuckles","amy","fang","metalsonic"} local function onWhiteList(player, list) for _, skin in pairs(list) do if player.mo.skin == skin return true end end return false end addHook("PlayerThink", function(p) local mo = p.mo if not (p and p.valid) return end --Check whether Player exists if not onWhiteList(p, whitelist) return end --Check whether Player's skin is on the whitelist //if skins[mo.skin].flags & SF_NOJUMPSPIN return end --Check whether Player spins while jumping by default p.charflags = $|SF_NOJUMPSPIN --Disable vanilla jumpspin if p.pflags & PF_JUMPED and p.panim ~= PA_ABILITY and not (p.pflags & PF_THOKKED) local apex = FixedMul(4*mo.scale, min(skins[mo.skin].jumpfactor, FRACUNIT)) --Determine jump apex, if mo.eflags & MFE_UNDERWATER --Correct for being underwater, apex = 117*$/200 end if mo.momz > -apex and mo.momz < apex --while at apex of jump, if mo.state ~= S_PLAY_ROLL mo.state = S_PLAY_ROLL --Spinning animation end else if not (mo.eflags & MFE_VERTICALFLIP) and mo.momz > 0 --when going up, or mo.eflags & MFE_VERTICALFLIP and mo.momz < 0 --or down in reverse gravity, if mo.state ~= S_PLAY_JUMP and mo.state ~= S_PLAY_SPRING mo.state = S_PLAY_JUMP --Jumping animation end end if not (mo.eflags & MFE_VERTICALFLIP) and mo.momz < 0 --when going down, or mo.eflags & MFE_VERTICALFLIP and mo.momz > 0 --or up in reverse gravity, if mo.state ~= S_PLAY_FALL mo.state = S_PLAY_FALL --Falling animation end end end elseif p.pflags & PF_THOKKED and not (p.prevpflags & PF_THOKKED) and p.panim ~= PA_ROLL if p.charability == CA_THOK or p.charability == CA_JUMPTHOK or p.charability == CA_HOMINGTHOK and p.homing mo.state = S_PLAY_ROLL --Set rolling animation when using a thok ability end end p.prevpflags = p.pflags end)