Skip to content

Commit 749815f

Browse files
author
John Grib
committed
add 'Q' : quit and close game
1 parent f239cfa commit 749815f

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11

22
# VimGameCodeBreak
33

4-
version 0.1
5-
64
![animated demonstration](https://user-images.githubusercontent.com/1855714/27774457-7e001646-5fcd-11e7-9e90-c37eafefad9c.gif)
75

86
## How to play
97

108
1. open your code or text file in Vim
119
1. `:VimGameCodeBreak` to Start
1210

13-
h | l | space | ` | ] | [ | q
14-
--- | --- | --- | --- | --- | --- | ---
15-
← | → | new ball | cheat key | GOD mode | human mode | quit
11+
h | l | space | ` | ] | [ | q | Q
12+
--- | --- | --- | --- | --- | --- | --- | ---
13+
← | → | new ball | cheat key | GOD mode | human mode | end game | quit & close game
1614

1715
## Installation
1816

autoload/VimGameCodeBreak/game.vim

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ function! VimGameCodeBreak#game#main()
6363

6464
endwhile
6565

66+
if s:loop == -1
67+
bdelete
68+
endif
69+
6670
endfunction
6771

6872
function! VimGameCodeBreak#game#createNewItem(x, y, dir)
@@ -112,6 +116,11 @@ function! s:initKeys()
112116
let key['['] = funcref('<SID>disableGodMode')
113117

114118
function key.q()
119+
call s:end()
120+
call VimGameCodeBreak#compatiblity#quit()
121+
endfunction
122+
123+
function key.Q()
115124
call s:quit()
116125
call VimGameCodeBreak#compatiblity#quit()
117126
endfunction
@@ -196,6 +205,10 @@ function! s:quit()
196205
let s:loop = -1
197206
endfunction
198207

208+
function! s:end()
209+
let s:loop = 0
210+
endfunction
211+
199212
function! s:enableGodMode()
200213
let s:godMode = 1
201214
for l:item in s:item

0 commit comments

Comments
 (0)