Skip to content

Commit

Permalink
Merge pull request #32 from walsh9/walsh9/v1.2.1
Browse files Browse the repository at this point in the history
v1.2.1
  • Loading branch information
walsh9 authored Aug 18, 2016
2 parents 98ed5d5 + f537a9f commit 2dcc9ea
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 6 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ Guide Bisby safely through 7 levels to reach the surface.

#Changelog

## v1.2.1
- Press space to restart instead of any key
- Bug fixes

## v1.2.0
- Animated motion between tiles
- Sound effects! Toggle with 'S'.
Expand Down
18 changes: 17 additions & 1 deletion assets/js/crates.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,33 @@ Game.Crates.Group = {
});
},
act: function() {
this.sanityCheck();
this._sortCrates();
return this.crateList.reduce(function(prevPromise, crate) {
return prevPromise.then(function() {
return crate.act();
});
}, Promise.resolve());
},
_sortCrates() {
_sortCrates: function() {
this.crateList = this.crateList.sort(function(crateA, crateB) {
return (crateB.y * 100 + crateB.x) - (crateA.y * 100 + crateA.x);
});
},
sanityCheck: function() {
var entitiesInMotion = Object.keys(Game.currentScreen.map.entities)
.map(function(key) {
return Game.currentScreen.map.entities[key]
})
.filter(function(entity) {
return ((entity.crateType !== undefined && entity.falling > 0) ||
entity.isPlayer ||
entity.canKill
);
});
if (entitiesInMotion.length === 0) {
Game.currentScreen.map.engine.lock();
}
}
}

Expand Down
1 change: 1 addition & 0 deletions assets/js/map-generators.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ Game.Map.Generators.Basic = {
addPlayer: function(map, player) {
player.x = Math.floor(map.grid.width / 2);
player.y = map.grid.height - 2;
map.grid.getCell(player.x, player.y).dug = true;
map.addEntity(player);
map.targets = [player];
}
Expand Down
3 changes: 2 additions & 1 deletion assets/js/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ Game.Map = {
}
var key = entity.x + ',' + entity.y;
if (this.entities[key]) {
throw new Error('Tried to add an entity at an occupied position.');
var errorMessage = 'Tried to add ' + entity.tile + ' at ' + key + ', but ' + this.entities[key].tile + ' was already there.';
throw new Error(errorMessage);
}
entity.slidingX = entity.x;
entity.slidingY = entity.y;
Expand Down
8 changes: 5 additions & 3 deletions assets/js/screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Game.Screen.playScreen = {
}
},
newLevel: function(level) {
this.lockInput();
var width = Game.mapSize.x;
var height = Game.mapSize.y;
this.levelOptions = Game.levels[level - 1];
Expand All @@ -74,6 +75,8 @@ Game.Screen.playScreen = {
generator.digPaths(this.map);
generator.populate(this.map);
this.grid = this.map.grid;
this.inputBuffer = [];
this.unlockInput();
this.map.engine.start();
},
render: function(display) {
Expand Down Expand Up @@ -123,7 +126,7 @@ Game.Screen.playScreen = {
gameOverLabel.anchor.set(0.5, 0);
Game.stage.addChild(gameOverLabel);

var pressKeyLabel = new PIXI.Text("Press any key to restart.", {font:"20px Audiowide", fill:"white"});
var pressKeyLabel = new PIXI.Text("Press [space] to try again.", {font:"20px Audiowide", fill:"white"});
pressKeyLabel.x = Game.stage.width / 2;
pressKeyLabel.y = Game.tileSize.y;
pressKeyLabel.anchor.set(0.5, 0);
Expand Down Expand Up @@ -192,7 +195,6 @@ Game.Screen.playScreen = {
},
unlockInput: function() {
this.inputLocked = false;
this.nextInput();
},
nextInput: function() {
if (this.inputBuffer.length > 0) {
Expand All @@ -205,7 +207,7 @@ Game.Screen.playScreen = {
},
handleInput: function(inputType, inputData) {
// If the game is over, enter will bring the user to the losing screen.
if (this.gameEnded) {
if (this.gameEnded && inputType === 'keydown' && inputData.keyCode === ROT.VK_SPACE) {
document.location.reload();
return;
}
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ <h1>Bisby's Escape</h1>
<div class="game"></div>

<div class="message">
<p>This is version 1.2.0, with bugfixes and <a href="https://github.com/walsh9/7drl2016#11">other changes</a>.</p>
<p>This is version 1.2.1, with bugfixes and <a href="https://github.com/walsh9/7drl2016#11">other changes</a>.</p>
<p>For the original 7DRL release, <a href="7drl/">click here</a>.</p>
</div>

Expand Down

0 comments on commit 2dcc9ea

Please sign in to comment.