aboutsummaryrefslogtreecommitdiffstats
path: root/autoload/space_vlaze
diff options
context:
space:
mode:
authorTeddy Wing2015-10-04 13:15:56 -0400
committerTeddy Wing2015-10-04 13:15:56 -0400
commit9b09b6d8bacdc48858e82ce072fe8e33db8558a9 (patch)
tree98152318f309a6d852eb255045066ba89d26cd8a /autoload/space_vlaze
parent70ae783d2d78cc9c7b79f044b999c0ee150cf595 (diff)
downloadvim-space-vlaze-9b09b6d8bacdc48858e82ce072fe8e33db8558a9.tar.bz2
game.vim: Save player coordinates to script globals
These aren't constants so maybe they shouldn't be in all caps but wanted an easy way to know the current coordinates of a player. This should make player movement easier.
Diffstat (limited to 'autoload/space_vlaze')
-rw-r--r--autoload/space_vlaze/game.vim4
1 files changed, 3 insertions, 1 deletions
diff --git a/autoload/space_vlaze/game.vim b/autoload/space_vlaze/game.vim
index 54fa6f9..e975bd6 100644
--- a/autoload/space_vlaze/game.vim
+++ b/autoload/space_vlaze/game.vim
@@ -23,6 +23,8 @@ function! space_vlaze#game#SetupBoard()
let s:board = []
let s:BOARD_HEIGHT = 20
let s:BOARD_WIDTH = 80
+ let s:PLAYER_X = s:BOARD_WIDTH / 2 - 1
+ let s:PLAYER_Y = s:BOARD_HEIGHT / 2
" Create 20-row by 80-column board initialised with spaces
let i = 0
@@ -40,7 +42,7 @@ function! space_vlaze#game#SetupBoard()
endwhile
" Initialise player to the middle of the board
- let s:board[s:BOARD_HEIGHT / 2][s:BOARD_WIDTH / 2 - 1] = space_vlaze#player#PlayerCharacter()
+ let s:board[s:PLAYER_Y][s:PLAYER_X] = space_vlaze#player#PlayerCharacter()
endfunction