addHook("ThinkFrame", do
    for player in players.iterate do
	 if player.mo and player.mo.valid
		if player.mo.skin == "sonic"
        and (player.mo.state == S_PLAY_WALK or player.mo.state == S_PLAY_RUN or player.mo.state == S_PLAY_SKID)
		and player.mo.momz > 0
		and not P_IsObjectOnGround(player.mo)
			player.mo.state = S_PLAY_SPRING
		end
		if player.mo.skin == "sonic"
		and (player.mo.state == S_PLAY_WALK or player.mo.state == S_PLAY_RUN or player.mo.state == S_PLAY_SKID)
		and player.mo.momz < 1
		and not P_IsObjectOnGround(player.mo)
			player.mo.state = S_PLAY_FALL
			end
        end
	end
end)

addHook("ThinkFrame", do
    for player in players.iterate do
	 if player.mo and player.mo.valid
		if player.mo.skin == "blueshoessonic"
        and (player.mo.state == S_PLAY_WALK or player.mo.state == S_PLAY_RUN or player.mo.state == S_PLAY_SKID)
		and not player.powers[pw_super]
		and player.mo.momz > 0
		and not P_IsObjectOnGround(player.mo)
			player.mo.state = S_PLAY_SPRING
		end
		if player.mo.skin == "blueshoessonic"
		and (player.mo.state == S_PLAY_WALK or player.mo.state == S_PLAY_RUN or player.mo.state == S_PLAY_SKID)
		and not player.powers[pw_super]
		and player.mo.momz < 1
		and not P_IsObjectOnGround(player.mo)
			player.mo.state = S_PLAY_FALL
			end
        end
	end
end)

addHook("ThinkFrame", do
    for player in players.iterate do
	 if player.mo and player.mo.valid
		if player.mo.skin == "tails"
        and (player.mo.state == S_PLAY_WALK or player.mo.state == S_PLAY_RUN or player.mo.state == S_PLAY_SKID)
		and not player.powers[pw_super]
		and player.mo.momz > 0
		and not P_IsObjectOnGround(player.mo)
			player.mo.state = S_PLAY_SPRING
		end
		if player.mo.skin == "tails"
		and (player.mo.state == S_PLAY_WALK or player.mo.state == S_PLAY_RUN or player.mo.state == S_PLAY_SKID)
		and not player.powers[pw_super]
		and player.mo.momz < 1
		and not P_IsObjectOnGround(player.mo)
			player.mo.state = S_PLAY_FALL
			end
        end
	end
end)

addHook("ThinkFrame", do
    for player in players.iterate do
	 if player.mo and player.mo.valid
		if player.mo.skin == "knuckles"
        and (player.mo.state == S_PLAY_WALK or player.mo.state == S_PLAY_RUN or player.mo.state == S_PLAY_SKID)
		and not player.powers[pw_super]
		and player.mo.momz > 0
		and not P_IsObjectOnGround(player.mo)
			player.mo.state = S_PLAY_SPRING
		end
		if player.mo.skin == "knuckles"
		and (player.mo.state == S_PLAY_WALK or player.mo.state == S_PLAY_RUN or player.mo.state == S_PLAY_SKID)
		and not player.powers[pw_super]
		and player.mo.momz < 1
		and not P_IsObjectOnGround(player.mo)
			player.mo.state = S_PLAY_FALL
			end
        end
	end
end)


addHook("ThinkFrame", do
    for player in players.iterate do
	 if player.mo and player.mo.valid
		if player.mo.skin == "amy"
        and (player.mo.state == S_PLAY_WALK or player.mo.state == S_PLAY_RUN or player.mo.state == S_PLAY_SKID)
		and not player.powers[pw_super]
		and player.mo.momz > 0
		and not P_IsObjectOnGround(player.mo)
			player.mo.state = S_PLAY_SPRING
		end
		if player.mo.skin == "amy"
		and (player.mo.state == S_PLAY_WALK or player.mo.state == S_PLAY_RUN or player.mo.state == S_PLAY_SKID)
		and not player.powers[pw_super]
		and player.mo.momz < 1
		and not P_IsObjectOnGround(player.mo)
			player.mo.state = S_PLAY_FALL
			end
        end
	end
end)
