Have it be a coinflip whether you or a slime will die
This commit is contained in:
parent
500fe1caed
commit
3303c52fbc
2
README
2
README
|
@ -1,7 +1,7 @@
|
|||
A dungeon crawler. That is, you are crawling around in a dungeon.
|
||||
|
||||
Find the Orb of Èitmer hidden within the dungeon, and beware the slimes for
|
||||
they will consume you if they catch up to you.
|
||||
it is up to chance whether you or they will prevail should you meet.
|
||||
|
||||
Movement:
|
||||
|
||||
|
|
|
@ -602,7 +602,7 @@ function newGame()
|
|||
end
|
||||
|
||||
function moveSlimes()
|
||||
for i, slime in ipairs(slimes) do
|
||||
for i, slime in pairs(slimes) do
|
||||
local dx = 0
|
||||
local dy = 0
|
||||
|
||||
|
@ -651,6 +651,17 @@ function moveSlimes()
|
|||
end
|
||||
end
|
||||
|
||||
function killSlime()
|
||||
local body_x, body_y = getBodyLocation()
|
||||
|
||||
for i, slime in pairs(slimes) do
|
||||
if slime.x == player_x and slime.y == player_y or slime.x == body_x and slime.y == body_y then
|
||||
cavern[slime.x][slime.y] = tiletypes.empty
|
||||
slimes[i] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function step(direction)
|
||||
if game_mode == gamemodes.normal then
|
||||
if last_direction_moved == direction then
|
||||
|
@ -673,7 +684,11 @@ function step(direction)
|
|||
end
|
||||
|
||||
if collidedPlayerSlime() then
|
||||
newGame()
|
||||
if math.random(0, 1) == 0 then
|
||||
newGame()
|
||||
else
|
||||
killSlime()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue