wip
This commit is contained in:
parent
19c2504bed
commit
1022d83857
1 changed files with 10 additions and 8 deletions
18
main.lua
18
main.lua
|
@ -8,8 +8,10 @@ function love.load()
|
||||||
|
|
||||||
fov = 30
|
fov = 30
|
||||||
|
|
||||||
|
width = 1024
|
||||||
|
height = 512
|
||||||
love.graphics.setBackgroundColor(0, 0, 0, 1)
|
love.graphics.setBackgroundColor(0, 0, 0, 1)
|
||||||
love.window.setMode(1024, 512)
|
love.window.setMode(width, height)
|
||||||
|
|
||||||
player = {}
|
player = {}
|
||||||
player["x"] = 96
|
player["x"] = 96
|
||||||
|
@ -89,8 +91,8 @@ function love.update()
|
||||||
end
|
end
|
||||||
|
|
||||||
function love.draw()
|
function love.draw()
|
||||||
drawMap()
|
-- drawMap()
|
||||||
drawPlayer()
|
-- drawPlayer()
|
||||||
drawRays3D()
|
drawRays3D()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -250,11 +252,11 @@ function drawRays3D()
|
||||||
end
|
end
|
||||||
disT = disT * math.cos(ca)
|
disT = disT * math.cos(ca)
|
||||||
|
|
||||||
local lineH = int(map.size * 320 / disT)
|
local lineH = int(map.size * height / disT)
|
||||||
if lineH > 320 then
|
if lineH > height then
|
||||||
lineH = 320
|
lineH = height
|
||||||
end
|
end
|
||||||
local lineO = int(160 - (lineH / 2))
|
local lineO = int((height / 2)- (lineH / 2))
|
||||||
|
|
||||||
love.graphics.setPointSize(8)
|
love.graphics.setPointSize(8)
|
||||||
love.graphics.setColor(1, 1, 1)
|
love.graphics.setColor(1, 1, 1)
|
||||||
|
@ -262,7 +264,7 @@ function drawRays3D()
|
||||||
for y = 0, top do
|
for y = 0, top do
|
||||||
if y == 0 or y == top then
|
if y == 0 or y == top then
|
||||||
love.graphics.points(
|
love.graphics.points(
|
||||||
r * 8 + 530, y + lineO
|
r * 8 + (width / 4) , y + lineO
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue