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
|
||||
|
||||
width = 1024
|
||||
height = 512
|
||||
love.graphics.setBackgroundColor(0, 0, 0, 1)
|
||||
love.window.setMode(1024, 512)
|
||||
love.window.setMode(width, height)
|
||||
|
||||
player = {}
|
||||
player["x"] = 96
|
||||
|
@ -89,8 +91,8 @@ function love.update()
|
|||
end
|
||||
|
||||
function love.draw()
|
||||
drawMap()
|
||||
drawPlayer()
|
||||
-- drawMap()
|
||||
-- drawPlayer()
|
||||
drawRays3D()
|
||||
end
|
||||
|
||||
|
@ -250,11 +252,11 @@ function drawRays3D()
|
|||
end
|
||||
disT = disT * math.cos(ca)
|
||||
|
||||
local lineH = int(map.size * 320 / disT)
|
||||
if lineH > 320 then
|
||||
lineH = 320
|
||||
local lineH = int(map.size * height / disT)
|
||||
if lineH > height then
|
||||
lineH = height
|
||||
end
|
||||
local lineO = int(160 - (lineH / 2))
|
||||
local lineO = int((height / 2)- (lineH / 2))
|
||||
|
||||
love.graphics.setPointSize(8)
|
||||
love.graphics.setColor(1, 1, 1)
|
||||
|
@ -262,7 +264,7 @@ function drawRays3D()
|
|||
for y = 0, top do
|
||||
if y == 0 or y == top then
|
||||
love.graphics.points(
|
||||
r * 8 + 530, y + lineO
|
||||
r * 8 + (width / 4) , y + lineO
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue