diff options
| author | Teddy Wing | 2015-10-07 04:17:14 -0400 |
|---|---|---|
| committer | Teddy Wing | 2015-10-07 04:17:14 -0400 |
| commit | bb54411c76a7765af8a06d15ee748251c2a1dcc4 (patch) | |
| tree | 6b36620c5898dc4086ab0aaf7fb51c809ec18d18 /autoload/space_vlaze/life.vim | |
| parent | 1a2cdf4bb9b233323d8d7ada63eeffffce6ebd1a (diff) | |
| download | vim-space-vlaze-bb54411c76a7765af8a06d15ee748251c2a1dcc4.tar.bz2 | |
Add lives
* Create life.vim to keep track of lives
* Players start with 3 lives
* Add increment and decrement functions for lives because they'll be
useful in the future (although there's a more immediate need for the
decrement function)
* Render lives at the bottom of the board
* Move the score line down so that it appears just below the life count
display
Diffstat (limited to 'autoload/space_vlaze/life.vim')
| -rw-r--r-- | autoload/space_vlaze/life.vim | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/autoload/space_vlaze/life.vim b/autoload/space_vlaze/life.vim new file mode 100644 index 0000000..1d300bd --- /dev/null +++ b/autoload/space_vlaze/life.vim @@ -0,0 +1,28 @@ +function! space_vlaze#life#Initialize() + let s:lives = 3 +endfunction + + +function! space_vlaze#life#IncrementLives() + let s:lives += 1 +endfunction + + +function! space_vlaze#life#DecrementLives() + let s:lives -= 1 +endfunction + + +function! space_vlaze#life#RenderLives() + let lives_line = space_vlaze#game#BoardHeight() + 1 + let lives_display = '' + + let i = 0 + while i < s:lives + let lives_display .= space_vlaze#player#PlayerCharacter() . ' ' + + let i += 1 + endwhile + + call setline(lives_line, lives_display) +endfunction |
