From 9b09b6d8bacdc48858e82ce072fe8e33db8558a9 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 4 Oct 2015 13:15:56 -0400 Subject: 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. --- autoload/space_vlaze/game.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3