Create doom-styled directional sprites

Recently, I’ve been trying to figure out how to do spritesheets with roblox, and I decided that I wanted to create a doom/room style of characters using sprites.

However, I noticed that using decals and surfaceguis with imagelabels have their limits, and I wasn’t able to make them look placed well together.

If you look through this video, you will see that the characters have different sprites for each side, and they transition very smoothly, so I was wondering how I could create an effect like this.

Credit to @PoptartNoahh for the video

Any help will be much appreciated!

EDIT:

I found a page on scriptinghelpers that gave some code on how they did these kind of sprites
The video
And the code they gave was:

wait(2)
local EnemyFolder = game.Workspace.Enemies
local PlayerTorso = game.Players.LocalPlayer.Character:WaitForChild("UpperTorso")
local Enemy = game.Workspace.SpritePart

--This function is used to make only the X and Z rotate
function rotateYaxis(originalPos, lookAtPos)
	return CFrame.new(originalPos,Vector3.new(lookAtPos.X,originalPos.Y,lookAtPos.Z))
end

--I use a for loop so I can have many enemies rotate with no further scripts
while wait() do
	Enemy.Screen.CFrame = rotateYaxis(Enemy.Screen.Position, PlayerTorso.Position)
end

It just makes a part face towards the player, however, I need to figure out how to get the effect shown in the video

4 Likes

This is what I use, enjoy


local function getAngle(root)
	local p1 = root.CFrame.Position
	local p2 = Camera.CFrame.Position
	local vector = p2 - p1
	local r0 = math.rad(root.Orientation.Y)
	local r1 = r0 < 0 and tau - math.abs(r0) or r0
	local a0 = math.atan2(vector.Z, vector.X) + math.pi * 0.5
	local a1 = ((a0 < 0 and tau - math.abs(a0) or a0) + r1)
	local a2 = (a1 % tau) * 8 / tau
	return (math.round(a2) % 8) + 1
end


13 Likes

Thanks so much! I really appreciate it!