diff options
| author | Teddy Wing | 2015-10-04 14:16:14 -0400 | 
|---|---|---|
| committer | Teddy Wing | 2015-10-04 14:16:14 -0400 | 
| commit | 69587e1338a2c54596b0c3bbeb414479368c6b7a (patch) | |
| tree | c009d2cb324ef8289118a2d8b634d0b540ce9fd5 /autoload/space_vlaze/mappings.vim | |
| parent | 9b09b6d8bacdc48858e82ce072fe8e33db8558a9 (diff) | |
| download | vim-space-vlaze-69587e1338a2c54596b0c3bbeb414479368c6b7a.tar.bz2 | |
Add player movement (WIP)
Kind of add player movement.
TODO: Update player coordinates when moving
* Add a main game loop to `space_vlaze#game#Init`
* Fill in player directional movement functions
* game.vim: Add functions to access and set `s:` variables so these can
  be accessed from player.vim
* Add new mappings based on
  https://github.com/mattn/invader-vim/blob/f04e7f5e8ac42ae87db6050e64449055206c4054/plugin/invader.vim#L44-L60
  because it turns out that the mappings we previously defined don't
  work when out main loop is running.
Diffstat (limited to 'autoload/space_vlaze/mappings.vim')
| -rw-r--r-- | autoload/space_vlaze/mappings.vim | 21 | 
1 files changed, 21 insertions, 0 deletions
| diff --git a/autoload/space_vlaze/mappings.vim b/autoload/space_vlaze/mappings.vim index 65cfe6e..9194eb0 100644 --- a/autoload/space_vlaze/mappings.vim +++ b/autoload/space_vlaze/mappings.vim @@ -7,3 +7,24 @@ function! space_vlaze#mappings#Initialize()  	nnoremap <silent><buffer> l       :call space_vlaze#player#MoveRight()<cr>  	nnoremap <silent><buffer> <space> :call space_vlaze#player#FireBlasters()<cr>  endfunction + + +function! space_vlaze#mappings#Listen() +	let c = nr2char(getchar(0)) +	 +	if c ==# 'q' +		call space_vlaze#game#Quit() +	elseif c ==# 'p' +		call space_vlaze#game#Pause() +	elseif c ==# 'h' +		call space_vlaze#player#MoveLeft() +	elseif c ==# 'j' +		call space_vlaze#player#MoveDown() +	elseif c ==# 'k' +		call space_vlaze#player#MoveUp() +	elseif c ==# 'l' +		call space_vlaze#player#MoveRight() +	elseif c ==# '\<space>' +		call space_vlaze#player#FireBlasters() +	endif +endfunction | 
