Skip to content

Commit

Permalink
Fixed #14 - Dig should not be possible if guard is too close
Browse files Browse the repository at this point in the history
- Added a delay when runner is dead
  • Loading branch information
lvcabral committed Sep 24, 2016
1 parent 3933880 commit 9a3504f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
20 changes: 10 additions & 10 deletions source/charRunner.brs
Original file line number Diff line number Diff line change
Expand Up @@ -95,21 +95,21 @@ Function can_dig() as boolean
rsp = false
if (m.keyDL() or (m.charAction = "runLeft" and not m.keyDR())) and x > 1
if y < m.const.TILES_Y and x > 0
if m.level.map[x-1][y+1].act = m.const.MAP_BLOCK
if m.level.map[x-1][y].act = m.const.MAP_EMPTY
if m.level.map[x-1][y].base <> m.const.MAP_GOLD
rsp = true
end if
lTile = m.level.map[x-1][y+1]
dTile = m.level.map[x-1][y]
if lTile.act = m.const.MAP_BLOCK and dTile.act = m.const.MAP_EMPTY
if dTile.base <> m.const.MAP_GOLD and not dTile.guard
rsp = true
end if
end if
end if
else if (m.keyDR() or m.charAction = "runRight") and x < m.const.TILES_X - 2
if y < m.const.TILES_Y and x < m.const.TILES_X
if m.level.map[x+1][y+1].act = m.const.MAP_BLOCK
if m.level.map[x+1][y].act = m.const.MAP_EMPTY
if m.level.map[x+1][y].base <> m.const.MAP_GOLD
rsp = true
end if
rTile = m.level.map[x+1][y+1]
dTile = m.level.map[x+1][y]
if rTile.act = m.const.MAP_BLOCK and dTile.act = m.const.MAP_EMPTY
if dTile.base <> m.const.MAP_GOLD and not dTile.guard
rsp = true
end if
end if
end if
Expand Down
1 change: 1 addition & 0 deletions source/gameScreen.brs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Function PlayGame() as boolean
'Check runner death
if not m.runner.alive
PlaySound("dead")
Sleep(800)
m.runner.health--
if m.runner.health > 0
ResetGame()
Expand Down

0 comments on commit 9a3504f

Please sign in to comment.