Compare commits

...

2 Commits

Author SHA1 Message Date
Juhani Krekelä 81585b9baf Update README 2019-06-30 21:06:29 +03:00
Juhani Krekelä 361961ab9e Create a vector version of the win image, and get rid of the terrible programmer art 2019-06-30 21:03:55 +03:00
3 changed files with 59 additions and 16 deletions

11
README
View File

@ -3,15 +3,16 @@ you can't easily turn around in tight spaces and your vision to where you
came from is limited.
Find the Orb of Èitmer hidden within the dungeon, and beware the slimes for
it is up to chance whether you or they will prevail should you meet.
it is up to chance whether you or they will prevail should you meet. It is
however better to face them head-on than to suffer an attack from behind.
If you find yourself stuck in a corner, try moving diagonally backwards.
Movement:
i
jkl - movement up, left, down, right
u i o
j l
m k .
u o
m . - movement upleft, downleft, downright, upright
space - do nothing for a turn
r - restart

View File

@ -47,6 +47,7 @@ direction_keys['space'] = directions.inplace
local control_keys = {quit = 'q', restart = 'r', configure = 'c', autoexplore = 'a'}
local win_image = nil
local win_is_raster = false
-- ------------------------------------------------------------------
-- Cavern generation
@ -971,25 +972,64 @@ function drawHP()
local x = (i - 1) * scale + x_offset
local y = y_offset
love.graphics.setColor(1, 1, 1)
love.graphics.draw(heart_sprite, x, y, 0, scale/16, scale/16)
end
end
function drawWin()
local img_width, img_height = win_image:getDimensions()
if win_is_raster then
local img_width, img_height = win_image:getDimensions()
local screen_width = love.graphics.getWidth()
local screen_height = love.graphics.getHeight()
local screen_width = love.graphics.getWidth()
local screen_height = love.graphics.getHeight()
local width_scale = screen_width / img_width
local height_scale = screen_height / img_height
local scale = math.min(width_scale, height_scale)
local width_scale = screen_width / img_width
local height_scale = screen_height / img_height
local scale = math.min(width_scale, height_scale)
local x_offset = (screen_width - img_width * scale) / 2
local y_offset = (screen_height - img_height * scale) / 2
local x_offset = (screen_width - img_width * scale) / 2
local y_offset = (screen_height - img_height * scale) / 2
love.graphics.setColor(1, 1, 1)
love.graphics.draw(win_image, x_offset, y_offset, 0, scale, scale)
love.graphics.setColor(1, 1, 1)
love.graphics.draw(win_image, x_offset, y_offset, 0, scale, scale)
else
local width = 20
local height = 20
local screen_width = love.graphics.getWidth()
local screen_height = love.graphics.getHeight()
local width_scale = screen_width / width
local height_scale = screen_height / height
local scale = math.min(width_scale, height_scale)
local x_offset = (screen_width - width * scale) / 2
local y_offset = (screen_height - height * scale) / 2
local vertices = {10, 7, 6, 8, 5, 20, 15, 20, 14, 8}
local transformed_vertices = {}
for i = 1, #vertices, 2 do
local x = vertices[i] * scale + x_offset
local y = vertices[i + 1] * scale + y_offset
transformed_vertices[i] = x
transformed_vertices[i + 1] = y
end
love.graphics.setColor(0, 0, 1)
love.graphics.polygon('fill', transformed_vertices)
love.graphics.setColor(0.6, 0.3, 0.2)
love.graphics.circle('fill', 10 * scale + x_offset, 5 * scale + y_offset, 3 * scale)
love.graphics.setColor(0.5, 0.2, 0.1)
love.graphics.rectangle('fill', x_offset, 15 * scale + y_offset, 20 * scale, 10 * scale)
love.graphics.setColor(0, 1, 0)
love.graphics.circle('fill', 10 * scale + x_offset, 16 * scale + y_offset, 2 * scale)
end
end
function drawLoss()
@ -1077,7 +1117,9 @@ function love.load()
newGame()
win_image = love.graphics.newImage("win_image.png")
if win_is_raster then
win_image = love.graphics.newImage("win_image.png")
end
player_sprite = love.graphics.newImage("sprite.png")
player_sprite_crit = love.graphics.newImage("sprite_crit.png")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 0 B