| Age | Commit message (Collapse) | Author | 
|---|
|  | If the user has already defined a mapping for `<leader>sv` then don't
overwrite their mapping.
Also define a `<Plug>` mapping for this for users to map to if so
desired. | 
|  | Originally thought of Maize but had misspelled it as Maze. Was
considering Maiz so as to not be so literal, then decided that a more
French spelling looked nicer. | 
|  | Write Vim help for the plugin including an introduction, information
about the command and map provided, as well as gameplay instructions and
maps.
Also generate help tags. | 
|  | Since we're handling game actions in `mappings#Listen()` now, don't call
our functions from these normal mappings.
The reason for not doing so is because otherwise after you get a Game
Over you could still move the player around and fire missiles (although
doing so wouldn't affect your score).
Set these keys to `<nop>` so that they don't do their normal Vim
functions so we can maximise the feeling of being in the game world
versus being in a text editor. Otherwise you can move your cursor
around, record macros with `q`, and I'm just not sure I want to allow
all that in the game. | 
|  | Generated with Cfxr. | 
|  | Generated with Cfxr. | 
|  | Again created with Cfxr. (Godsend!) | 
|  | 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. | 
|  | When pressing `l` call the new name of the function we're using to
render the leaderboard as the original one I had put here was a stub. | 
|  | Output our "Leaderboard" header. Two lines needed to be surrounded in
double quotes since they contain single quotes and backslashes needed to
be escaped in those strings.
Output player name and high score value. Not very pretty unfortunately.
Using hard-coded left padding where it would be nice to calculate
padding needed to center the name and score.
Also would like to right-align score numerals but leaving it as an
enhancement as there are more pressing things to do for now. | 
|  | Set the same buffer-local window settings that we set for the game so we
can control the look and workings of things. | 
|  | Start of render function, initialising a new buffer for the leaderboard
and getting necessary data from our storage files.
Two font options generated from Figlet, one in "cybermedium" and the
other in "larry3d". Going to go with the "larry3d" one. | 
|  | When you get a game over, save your high score to a file so that we can
display it on the leaderboard. The saved scores get sorted from highest
to lowest.
If we don't have your name yet (saved to a separate file), we prompt you
for it.
This means that you can only have one player (name) per installation.
Not the best scenario because maybe you have multiple people playing on
your computer, but I made a judgement call to do it this way so we don't
have to keep prompting the player for their name every time they get a
Game Over. That could get annoying fast. | 
|  | Set the background colour for the game board to be my normal colour
scheme's background colour so that people with other colour schemes can
see the game with the full set of colours I've been working with.
Set the foreground colour to white to allow it to be readable over the
dark dark grey background (otherwise we wouldn't be able to read the
"Game Over" text). | 
|  | Pad these 2 status lines with spaces to the right of their string values
so that their background colours extend to the full width of the game
board.
First tried `len()`, then `strlen()` when counting characters in
`padding#RightPadding()` but turns out those deal with bytes and the
player character is a multi-byte character so we would come up sort on
spaces for padding in the Lives line because the player diamond counts
for double. To get around this, used `strchars()` which gives us a count
of the characters instead of the bytes. | 
|  | Add a space after the `|` pipe character we added in
c9934c4b1192f50ae0d6930381622c58fbe7048a to put some breathing room
between it and the diamond characters.
Went back and forth on this and neither looked quite right but I think
I'm going to go with this one. | 
|  | * Need to hard-code the enemy and player characters in order for the
  `syntax match` calls to work
* Enemies are a brownish colour (to remind you of popcorn kernels)
* The player is a pinkish colour because it's vibrant and contrasts with
  the brown of the enemies
* Lives have a maroon/burgundy background colour
* Score has a purple background colour that's similar enough in shade to
  the lives section to make it part of the same context but different
  enough to make it it's own section
* Add a `|` pipe character in front of score in order to be able to
  colour it correctly even if the player has 0 lives left. | 
|  | Base window/buffer-local settings on:
https://github.com/mattn/invader-vim/blob/f04e7f5e8ac42ae87db6050e64449055206c4054/plugin/invader.vim#L181-L189
Gives us a clean environment to display the game in. | 
|  | We do this in `menus#Start()` so there's no need for this. | 
|  | When pressing `q`, in addition to quitting the game also display the
"Game Over" screen.
Without this, when you quit the game the board would stay the same as it
was just before pressing `q`. It seemed kind of confusing not to have
any feedback that you quit the game so I figured I would do this to at
least let you know that you successfully quit the game. | 
|  | Don't prevent the menu from showing up on subsequent invocations of
`:SpaceVlaze`. This allows us to start multiple new games in the same
Vim session. | 
|  | Don't create a new Space Vlaze buffer if one already exists. | 
|  | Re-center the text since I added spaces between the letters. | 
|  |  | 
|  | When the player has 0 lives left then quit the game and display "Game
Over" text.
TODO: Request player name at this point to store in the leaderboard. | 
|  | Additionally extract `IsEnemyAtCell` function that determines whether an
enemy is located at a given cell. | 
|  | * Create life.vim to keep track of lives
* Players start with 3 lives
* Add increment and decrement functions for lives because they'll be
  useful in the future (although there's a more immediate need for the
  decrement function)
* Render lives at the bottom of the board
* Move the score line down so that it appears just below the life count
  display | 
|  | * Create score.vim to keep track of score and group scoring-related
  functions
* Increment player score when an enemy is defeated. The point count is
  based on a base value and a multiplier. Currently set to 1 for each
  such that each enemy is always worth 1 point. The multiplier is there
  so that as time increases we can increase the multiplier and increase
  the value of an enemy the longer the player plays.
* Render score to the screen so that it's visible to players. | 
|  | Instead of traversing the whole board and continuing to hit enemies
along the way, ensure that missiles stop when they hit their first
enemy.
This restructures the loop such that each missile acts independently of
the other three. | 
|  | When a missile hits an enemy, the enemy now disappears.
TODO:
* Add scoring
* Currently missiles don't stop when they hit an enemy so they'll just
  keep on killing enemies until they get to the edge of the board. | 
|  | Sets a board cell at a given set of coordinates to ' ' (space).
This allows us to call this new function from `ClearPlayerCell` instead
of having to pass in the empty cell string.
We need this function to be able to clear an enemy from the board when
it gets hit by a missile. | 
|  | Explain the while loop and condition here better than the code explains
it. | 
|  | Since `:python` didn't work out for me because of my system version
mismatch (1307eac), use Ruby to generate random numbers instead.
And w00t! this doesn't block the interface, rendering, and player
movement! | 
|  | Ostensibly this should work and generate us a random number using Python
without having to call `system`. My hope is that this call doesn't block
rendering and execution of our game.
The trouble is that I can't get it to work because I have Python 2.7.1
installed as my system Python (which Vim is linked against), and Python
2.7.9 installed via Homebrew. Vim is looking in the Homebrew path when
it should be looking in the system path to Python and causing this
error:
    Error detected while processing function space_vlaze#random#Random:
    line    7:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/random.py", line 47, in <module>
        from os import urandom as _urandom
    ImportError: cannot import name urandom
More information:
- https://github.com/klen/python-mode/issues/87
We could get around this by not having these 2 versions of Python
installed on our system (the random implementation changed between 2.7.2
and 2.7.3) or by setting `$PYTHONHOME` in our vimrc.
Could, but I'm sick of this shite. Would have liked to be able to use
Python for this because in my opinion Python tends to be pretty fast as
interpreted languages go, but frak it I'll just use Ruby. | 
|  | Add a bunch of enemies to the board. The count will depend on how long
you've been playing the game.
This currently kind of works in that it adds enemies to the board at
random coordinates and adds more as time goes on (too many actually,
I'll need to reduce the count or slow down the spawn rate).
The trouble is that it looks like it's blocking on the `system` call to
`python`. This is a problem because it freezes the board and prevents
any player movement while the Python random command is working. Let's
try using Vim's built in `:python` to do this to see if that makes any
difference.
game.vim:
  Add a `ticks` script variable that tracks clock ticks and increments
  each time our game loop executes. This will allow us to keep track of
  time in a consistent way and make it easier for us to pause time when
  we pause the game. Also, I envision it being easier to deal with
  smaller numbers starting from 0 instead of a whole Unix timestamp. Got
  the idea for ticks from Tetris.vim
  (http://www.vim.org/scripts/script.php?script_id=172)
enemy.vim:
  * Set player character to a spade (like in playing cards) because when
    it's small it could kind of look like a popcorn kernel
  * Set a min and max amount of enemies that can be on the board at any
    given time because we don't want a sparse board and we also don't
    want to overwhelm the player when they've been playing for a long
    time and the spawn count increases to an insane amount.
  * Create a function that will drop an enemy at random coordinates on
    the board not on the player's coordinates.
      TODO: we should extend this function to ensure enemies can't spawn
      within a certain radius of the player so that we don't get random
      instances of being a dick.
      TODO: also ensure that we don't place an enemy on top of another
      enemy or on top of a missile.
  * Every 5 seconds update the enemies on the board and regenerate them
    such that the enemy count is withing the min and max enemy counts. | 
|  | Add a random number generator based on this Stack Exchange post from
Carpetsmoker:
http://vi.stackexchange.com/questions/807/how-to-generate-random-numbers/812#812
Since Vimscript doesn't have a random number generator, shell out to
Python and get a random int between 0 and the max value passed in. | 
|  | Fire all 4 missiles and make sure they continue moving until all 4 of
them hit the edge instead of stopping when a single one hit the edge of
the board. | 
|  | Fire all 4 missiles at once. Currently doesn't work and stops when one
of the missiles hits the edge of the board. | 
|  | Remove missiles when they get to the end of the board. Otherwise they
just stay there right before the end. | 
|  | Create a missile moving to the right of the player. Pressing <space>
fires the missile. Later we'll want one coming out of each direction,
but this is just to test it out.
TODO:
* Clear missile when it gets to the edge of the board
* Make it so the missile doesn't block other actions on the board
  (including player and enemy movement) | 
|  | Ignore /private/ directory for things I don't want to include in the
repo. Currently have a possible idea for a soundtrack in there. | 
|  | We will always want to `redraw!` when we re-render the board, so call
`redraw!` from inside this function.
Noticed this when I was writing the missile firing code and realised
that I needed to re-render the board at each step in the missile
animation. | 
|  | Because `nr2char` gives us an actual space character instead of
`<space>` as I had thought given the examples I had seen of it. | 
|  | Change the backstory based on my Dad's recommendation that the enemy
ships should be popcorn kernels. This makes the story more fun and weird
and pacifistic.
Another possible idea from my conversation with my parents is that the
kernels could pop into popcorn when you hit them, and this would turn
them into collectibles. Let's see if I have time to make that work. | 
|  | Initial ideas for the backstory of the game. | 
|  | * Store player coordinates in `player.vim` instead of `game.vim` because
  they belong to a player instead of the game/board so it makes more
  sense to store them there.
* Remove old player functions from `game.vim`
* Update movement functions to ensure that they update the player
  coordinates in addition to updating the board array | 
|  | 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. | 
|  | 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. | 
|  | * Remove `<nowait>` since it isn't available in my version of Vim (7.3
  2010 Aug 15, compiled Jun 20 2012 13:16:02) and breaks the mappings if
  it's included.
* Create function stubs for all mappings
* Add missing `<cr>`s to end of mappings to make them work
* Initialise mappings when starting a game | 
|  |  |