I am trying to make a Wolfenstein3D-like game, using pico-8 (that's a 2d engine with many limitations) and the world just bends very weirdly.
Gif of running around
My code: (Warning LUA! Confusing language. starts counting at 1...! )
function ray_cast()
points = {}
for i=1,64 do
points[i] = -1
end
for o = -31,32 do
local angle = player.lvec - o/256
for i=0,96 do
local x,y
x = i * cos(angle)
y = i * sin(angle)
if mget((x+player.x)/8,(y+player.y)/8) == 1 then
local tx = i-1 * cos(angle)
local ty = i-1 * sin(angle)
local dis = sqrt((tx^2+ty^2))
points[o+32] = dis*cos(angle-player.lvec)
break
end
end
end
end
I asked for help in the PICO-8 discord and someone said they could help me, but after a lot of messaging, it still did not result in the solution I wanted.
Edit: New GIF
Distortion of things
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…