Add a "do nothing" button
This commit is contained in:
parent
fa6b47dcf9
commit
2935139060
|
@ -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()
|
||||
|
@ -822,6 +825,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 +859,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 +871,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