diff options
| author | Teddy Wing | 2015-10-08 03:46:57 -0400 | 
|---|---|---|
| committer | Teddy Wing | 2015-10-08 03:47:44 -0400 | 
| commit | f2ccd902a5f9534e2a8e83c65ec3875a81fefc26 (patch) | |
| tree | 0bbe12256a3df3eb40473bd762309ea465f239f4 | |
| parent | 63568407c0e2e585305c99be968d55d3416e64fe (diff) | |
| download | vim-space-vlaze-f2ccd902a5f9534e2a8e83c65ec3875a81fefc26.tar.bz2 | |
Add "enemy defeated" sound
Generated with Cfxr. Play a sound when an enemy is destroyed.
Sounds are located in the "Resources" directory. Audio is played using
`mplayer` if available.
| -rw-r--r-- | Resources/enemy-defeated.wav | bin | 0 -> 20068 bytes | |||
| -rw-r--r-- | autoload/space_vlaze/audio.vim | 15 | ||||
| -rw-r--r-- | autoload/space_vlaze/enemy.vim | 1 | 
3 files changed, 16 insertions, 0 deletions
| diff --git a/Resources/enemy-defeated.wav b/Resources/enemy-defeated.wavBinary files differ new file mode 100644 index 0000000..9a07e1b --- /dev/null +++ b/Resources/enemy-defeated.wav diff --git a/autoload/space_vlaze/audio.vim b/autoload/space_vlaze/audio.vim new file mode 100644 index 0000000..18d3e7f --- /dev/null +++ b/autoload/space_vlaze/audio.vim @@ -0,0 +1,15 @@ +if !exists('s:AUDIO_PATH') +	let s:AUDIO_PATH = resolve(expand('<sfile>:p:h')) . '/../../Resources' +endif + + +function! space_vlaze#audio#Play(filename) +	if executable('mplayer') +		call system('mplayer ' . s:AUDIO_PATH . '/' . a:filename . ' &') +	endif +endfunction + + +function! space_vlaze#audio#PlayEnemyDefeated() +	call space_vlaze#audio#Play('enemy-defeated.wav') +endfunction diff --git a/autoload/space_vlaze/enemy.vim b/autoload/space_vlaze/enemy.vim index cbe03f3..c91abc3 100644 --- a/autoload/space_vlaze/enemy.vim +++ b/autoload/space_vlaze/enemy.vim @@ -69,6 +69,7 @@ endfunction  " If an enemy lives at y, x, it needs to disappear and update the score.  function! space_vlaze#enemy#HandleEnemyHitAt(y, x)  	if space_vlaze#enemy#IsEnemyAtCell(a:y, a:x) +		call space_vlaze#audio#PlayEnemyDefeated()  		call space_vlaze#game#ClearBoardCell(a:y, a:x)  		call space_vlaze#score#IncrementScore(  			\ s:ENEMY_POINT_BASE * space_vlaze#enemy#PointMultiplier()) | 
