Compare commits
2 Commits
fa6b47dcf9
...
bf1cdb59c3
Author | SHA1 | Date |
---|---|---|
Juhani Krekelä | bf1cdb59c3 | |
Juhani Krekelä | 2935139060 |
1
README
1
README
|
@ -13,6 +13,7 @@ Movement:
|
|||
j l
|
||||
m k .
|
||||
|
||||
space - do nothing for a turn
|
||||
r - restart
|
||||
q - quit
|
||||
c - configure keybindings
|
||||
|
|
|
@ -9,7 +9,7 @@ local remembered_cavern = {}
|
|||
local spawn_x = nil
|
||||
local spawn_y = nil
|
||||
|
||||
local directions = {up = 0, upleft = 1, left = 2, downleft = 3, down = 4, downright = 5, right = 6, upright = 7}
|
||||
local directions = {up = 0, upleft = 1, left = 2, downleft = 3, down = 4, downright = 5, right = 6, upright = 7, inplace = 8}
|
||||
local player_x = nil
|
||||
local player_y = nil
|
||||
local player_direction = nil
|
||||
|
@ -35,6 +35,7 @@ direction_keys['k'] = directions.down
|
|||
direction_keys['.'] = directions.downright
|
||||
direction_keys['l'] = directions.right
|
||||
direction_keys['o'] = directions.upright
|
||||
direction_keys['space'] = directions.inplace
|
||||
local control_keys = {quit = 'q', restart = 'r', configure = 'c'}
|
||||
|
||||
local win_image = nil
|
||||
|
@ -676,7 +677,9 @@ function step(direction)
|
|||
|
||||
rememberVisible()
|
||||
|
||||
movePlayer(direction)
|
||||
if direction ~= directions.inplace then
|
||||
movePlayer(direction)
|
||||
end
|
||||
moveSlimes()
|
||||
|
||||
generateVisibilityMap()
|
||||
|
@ -722,6 +725,8 @@ function drawCavern()
|
|||
love.graphics.setColor(0, 1, 0)
|
||||
love.graphics.ellipse('fill', x + 0.5 * x_scale, y + 0.5 * y_scale, 0.7 * x_scale/2, 0.7 * y_scale/2)
|
||||
elseif tile == tiletypes.slime then
|
||||
love.graphics.setColor(0, 0, 0)
|
||||
love.graphics.rectangle('fill', x, y, x_scale, y_scale)
|
||||
love.graphics.setColor(0, 0, 1)
|
||||
love.graphics.ellipse('fill', x + 0.5 * x_scale, y + 0.5 * y_scale, 0.8 * x_scale/2, 0.8 * y_scale/2)
|
||||
love.graphics.rectangle('fill', x + 0.1 * x_scale , y + 0.5 * y_scale, 0.8 * x_scale, 0.8 * y_scale/2)
|
||||
|
@ -748,6 +753,8 @@ function drawCavern()
|
|||
love.graphics.setColor(0.2, 0.7, 0.2)
|
||||
love.graphics.ellipse('fill', x + 0.5 * x_scale, y + 0.5 * y_scale, 0.7 * x_scale/2, 0.7 * y_scale/2)
|
||||
elseif tile == tiletypes.slime then
|
||||
love.graphics.setColor(0.2, 0.2, 0.2)
|
||||
love.graphics.rectangle('fill', x, y, x_scale, y_scale)
|
||||
love.graphics.setColor(0.2, 0.2, 0.7)
|
||||
love.graphics.ellipse('fill', x + 0.5 * x_scale, y + 0.5 * y_scale, 0.8 * x_scale/2, 0.8 * y_scale/2)
|
||||
love.graphics.rectangle('fill', x + 0.1 * x_scale , y + 0.5 * y_scale, 0.8 * x_scale, 0.8 * y_scale/2)
|
||||
|
@ -822,6 +829,8 @@ function drawConfig()
|
|||
text = "Right"
|
||||
elseif configuration_step == directions.upright then
|
||||
text = "Up-Right"
|
||||
elseif configuration_step == directions.inplace then
|
||||
text = "Do nothing for a turn"
|
||||
else
|
||||
error("Impossible configuration step")
|
||||
end
|
||||
|
@ -854,8 +863,8 @@ end
|
|||
function love.keypressed(key)
|
||||
if game_mode == gamemodes.config then
|
||||
-- This is a hack. Each "enum value" corresponds to an integer, and we are iterating
|
||||
-- through them. -3 to -1 are control keys, and 0 to 7 are direction keys
|
||||
if configuration_step >= directions.up and configuration_step <= directions.upright then
|
||||
-- through them. -3 to -1 are control keys, and 0 to 8 are direction keys
|
||||
if configuration_step >= directions.up and configuration_step <= directions.inplace then
|
||||
direction_keys[key] = configuration_step
|
||||
elseif configuration_step == configuration_steps.quit then
|
||||
control_keys.quit = key
|
||||
|
@ -866,7 +875,7 @@ function love.keypressed(key)
|
|||
end
|
||||
|
||||
configuration_step = configuration_step + 1
|
||||
if configuration_step > directions.upright then
|
||||
if configuration_step > directions.inplace then
|
||||
game_mode = gamemodes.normal
|
||||
end
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue