aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2015-10-07 02:40:32 -0400
committerTeddy Wing2015-10-07 02:40:32 -0400
commit5957bb609e7e763fe83b4b695b3600c14a81d9d4 (patch)
tree64bcab3c09442a0c899b4b814c1a3e702ba2794f
parent8c808568f9d1087e1146d281bb3a63b543b43108 (diff)
downloadvim-space-vlaze-5957bb609e7e763fe83b4b695b3600c14a81d9d4.tar.bz2
game.vim: Create `ClearBoardCell` function
Sets a board cell at a given set of coordinates to ' ' (space). This allows us to call this new function from `ClearPlayerCell` instead of having to pass in the empty cell string. We need this function to be able to clear an enemy from the board when it gets hit by a missile.
-rw-r--r--autoload/space_vlaze/game.vim5
-rw-r--r--autoload/space_vlaze/player.vim2
2 files changed, 6 insertions, 1 deletions
diff --git a/autoload/space_vlaze/game.vim b/autoload/space_vlaze/game.vim
index 29ba52b..f712478 100644
--- a/autoload/space_vlaze/game.vim
+++ b/autoload/space_vlaze/game.vim
@@ -85,6 +85,11 @@ function! space_vlaze#game#SetBoardCell(y, x, value)
endfunction
+function! space_vlaze#game#ClearBoardCell(y, x)
+ call space_vlaze#game#SetBoardCell(a:y, a:x, ' ')
+endfunction
+
+
function! space_vlaze#game#IsBoardCellEmpty(y, x)
if space_vlaze#game#IsWithinBoard(a:y, a:x)
return s:board[a:y][a:x] ==# ' '
diff --git a/autoload/space_vlaze/player.vim b/autoload/space_vlaze/player.vim
index 51b38bb..969e9d3 100644
--- a/autoload/space_vlaze/player.vim
+++ b/autoload/space_vlaze/player.vim
@@ -24,7 +24,7 @@ endfunction
function! space_vlaze#player#ClearPlayerCell()
- call space_vlaze#game#SetBoardCell(space_vlaze#player#PlayerY(), space_vlaze#player#PlayerX(), ' ')
+ call space_vlaze#game#ClearBoardCell(space_vlaze#player#PlayerY(), space_vlaze#player#PlayerX())
endfunction