aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--autoload/space_vlaze/missile.vim27
1 files changed, 19 insertions, 8 deletions
diff --git a/autoload/space_vlaze/missile.vim b/autoload/space_vlaze/missile.vim
index 95f4e94..f2facbf 100644
--- a/autoload/space_vlaze/missile.vim
+++ b/autoload/space_vlaze/missile.vim
@@ -1,15 +1,26 @@
" Fires all (4) missiles around an origin corrdinate (should be the player)
function! space_vlaze#missile#FireAll(y, x)
- let missiles_firing = 1
+ let left = 1
+ let bottom = 1
+ let top = 1
+ let right = 1
+
let i = 1
- while missiles_firing
- 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')
+ while left || bottom || top || right
+ if left
+ let left = space_vlaze#missile#Move(a:y, a:x - i, 'left')
+ endif
+
+ if bottom
+ let bottom = space_vlaze#missile#Move(a:y + i, a:x, 'bottom')
+ endif
+
+ if top
+ let top = space_vlaze#missile#Move(a:y - i, a:x, 'top')
+ endif
- if !(left || bottom || top || right)
- let missiles_firing = 0
+ if right
+ let right = space_vlaze#missile#Move(a:y, a:x + i, 'right')
endif
sleep 20ms