Skip to content

Commit

Permalink
Introduce second player after level 10
Browse files Browse the repository at this point in the history
  • Loading branch information
atesgoral committed Feb 26, 2017
1 parent 68ed026 commit 8457f67
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ <h2>Annotated</h2>
exit = mapArea - mapWidthOrTileSize - 1; // inside bottom right wall

map = [
levelTransition = 1 // level transition counter (0: run game, >0: level transition)
level = levelTransition = 1 // level transition counter (0: run game, >0: level transition)
];

seed = 5; // PRNG (pseudo-random number generator) seed
Expand Down Expand Up @@ -107,6 +107,10 @@ <h2>Annotated</h2>
// place player on top left
map[mapWidthOrTileSize + 1] = 4; // player

level++ > 10 // if past level 10
? map[mapWidthOrTileSize * 2 - 2] = 4 // then introduce second player
: 0;

// place exit
map[exit] = 0 // empty space
};
Expand Down Expand Up @@ -155,8 +159,9 @@ <h2>Annotated</h2>
: map[dest] == 4 // else if the player is beneath the boulder
&& processed[j] == processCount - 1 // and if the boulder is falling
? tile = (
level = 1, // restart game
levelTransition = mapHeight, // restart level
seed = 5 // reset seed (restart game)
seed = 5 // reset seed
) // crush player (turn into blodied boulder)
: 0,
4: _ => // player handler
Expand Down Expand Up @@ -184,6 +189,7 @@ <h2>Annotated</h2>
mapArea: 'A',
exit: 'e',
levelTransition: 'o',
level: 'l',
tiles: 'p',
map: 'm',
tile: 't',
Expand Down

0 comments on commit 8457f67

Please sign in to comment.