1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
function! space_vlaze#player#PlayerCharacter()
return '◆'
endfunction
function! space_vlaze#player#PlayerX()
return s:PLAYER_X
endfunction
function! space_vlaze#player#SetPlayerX(player_x)
let s:PLAYER_X = a:player_x
endfunction
function! space_vlaze#player#PlayerY()
return s:PLAYER_Y
endfunction
function! space_vlaze#player#SetPlayerY(player_y)
let s:PLAYER_Y = a:player_y
endfunction
function! space_vlaze#player#ClearPlayerCell()
call space_vlaze#game#SetBoardCell(space_vlaze#player#PlayerY(), space_vlaze#player#PlayerX(), ' ')
endfunction
function! space_vlaze#player#MoveLeft()
call space_vlaze#player#ClearPlayerCell()
call space_vlaze#player#SetPlayerX(space_vlaze#player#PlayerX() - 1)
call space_vlaze#game#SetBoardCell(space_vlaze#player#PlayerY(), space_vlaze#player#PlayerX(), space_vlaze#player#PlayerCharacter())
endfunction
function! space_vlaze#player#MoveDown()
call space_vlaze#player#ClearPlayerCell()
call space_vlaze#player#SetPlayerY(space_vlaze#player#PlayerY() + 1)
call space_vlaze#game#SetBoardCell(space_vlaze#player#PlayerY(), space_vlaze#player#PlayerX(), space_vlaze#player#PlayerCharacter())
endfunction
function! space_vlaze#player#MoveUp()
call space_vlaze#player#ClearPlayerCell()
call space_vlaze#player#SetPlayerY(space_vlaze#player#PlayerY() - 1)
call space_vlaze#game#SetBoardCell(space_vlaze#player#PlayerY(), space_vlaze#player#PlayerX(), space_vlaze#player#PlayerCharacter())
endfunction
function! space_vlaze#player#MoveRight()
call space_vlaze#player#ClearPlayerCell()
call space_vlaze#player#SetPlayerX(space_vlaze#player#PlayerX() + 1)
call space_vlaze#game#SetBoardCell(space_vlaze#player#PlayerY(), space_vlaze#player#PlayerX(), space_vlaze#player#PlayerCharacter())
endfunction
function! space_vlaze#player#FireBlasters()
" Fire top, right, bottom, left blasters
" A single missile fires in each direction
" The missile moves outward from the player to the edge of the board
" The missile stops when it hits an enemy or the edge of the board
call space_vlaze#missile#FireAll(s:PLAYER_Y, s:PLAYER_X)
endfunction
|