diff options
| author | Teddy Wing | 2015-10-05 02:02:47 -0400 |
|---|---|---|
| committer | Teddy Wing | 2015-10-05 02:02:47 -0400 |
| commit | 2c506d28dccb0df69cb7da24c81555594211246d (patch) | |
| tree | d23212905e7f50ad0b23a079e2e1c58ee7aaceb4 | |
| parent | 1ff668c2f38c5bae5034a16f47e95adffdf57735 (diff) | |
| download | vim-space-vlaze-2c506d28dccb0df69cb7da24c81555594211246d.tar.bz2 | |
missile.vim: Fire all 4 missiles even if one hits the edge
Fire all 4 missiles and make sure they continue moving until all 4 of
them hit the edge instead of stopping when a single one hit the edge of
the board.
| -rw-r--r-- | autoload/space_vlaze/missile.vim | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/autoload/space_vlaze/missile.vim b/autoload/space_vlaze/missile.vim index 1d8d0c3..aa9da39 100644 --- a/autoload/space_vlaze/missile.vim +++ b/autoload/space_vlaze/missile.vim @@ -3,10 +3,14 @@ function! space_vlaze#missile#FireAll(y, x) let missiles_firing = 1 let i = 1 while missiles_firing - let missiles_firing = missiles_firing && space_vlaze#missile#Move(a:y, a:x + i, 'right') - let missiles_firing = missiles_firing && space_vlaze#missile#Move(a:y, a:x - i, 'left') - let missiles_firing = missiles_firing && space_vlaze#missile#Move(a:y - i, a:x, 'top') - let missiles_firing = missiles_firing && space_vlaze#missile#Move(a:y + i, a:x, 'bottom') + let left = space_vlaze#missile#Move(a:y, a:x - i, 'left') + let bottom = space_vlaze#missile#Move(a:y + i, a:x, 'bottom') + let top = space_vlaze#missile#Move(a:y - i, a:x, 'top') + let right = space_vlaze#missile#Move(a:y, a:x + i, 'right') + + if !(left || bottom || top || right) + let missiles_firing = 0 + endif sleep 20ms |
