Fight better with hands than with feet

This commit is contained in:
Juhani Krekelä 2019-06-30 12:44:53 +03:00
parent 507080a695
commit 15d9aa5dab
1 changed files with 10 additions and 6 deletions

View File

@ -437,11 +437,6 @@ function collidedPlayerOrb()
return cavern[player_x][player_y] == tiletypes.orb or cavern[body_x][body_y] == tiletypes.orb
end
function collidedPlayerSlime()
local body_x, body_y = getBodyLocation()
return cavern[player_x][player_y] == tiletypes.slime or cavern[body_x][body_y] == tiletypes.slime
end
-- ------------------------------------------------------------------
-- Player helper functions
-- ------------------------------------------------------------------
@ -693,7 +688,16 @@ function step(direction)
game_mode = gamemodes.won
end
if collidedPlayerSlime() then
local body_x, body_y = getBodyLocation()
if cavern[body_x][body_y] == tiletypes.slime then
killSlime()
hp = hp - 1
if hp == 0 then
flash_player_red_counter = 1
else
flash_player_red_counter = 0.2
end
elseif cavern[player_x][player_y] == tiletypes.slime then
killSlime()
if math.random() < 0.2 then
flash_player_white_counter = 0.2