diff --git a/package.json b/package.json index e48c35d..0f20725 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "browser-sync": "^2.7.5", "del": "^2.0.0", "gulp": "^3.8.11", + "gulp-filter": "^3.0.1", "gulp-jshint": "^1.11.2", "gulp-sass": "^2.0.1", "gulp-sourcemaps": "^1.5.2", diff --git a/public b/public index 5e8d87f..a13dfb6 160000 --- a/public +++ b/public @@ -1 +1 @@ -Subproject commit 5e8d87f9f0561dbdc495bdfd6bb813628c34f674 +Subproject commit a13dfb688ba196b16a9285553ff51a9a0d556749 diff --git a/src/game.js b/src/game.js index 12e3a34..03b7095 100644 --- a/src/game.js +++ b/src/game.js @@ -129,12 +129,14 @@ export default (function() { // code for firing function playerShoot() { /* jshint validthis:true */ - + var self = this; - var shot = new Shot('player'); + var shot; var mousemoveListener = function(e) { + if(!shot) { shot = new Shot('player'); } + if(!crosshair.visible) { crosshair.setVisible(true); } var newX = checkInBounds(Math.floor(e.offsetX / constants.gridSpacing)), @@ -148,7 +150,7 @@ export default (function() { var clickListener = function() { // check we haven't already taken this shot - if(shot.checkNotIntersecting(playerShots)) { + if(shot && shot.checkNotIntersecting(playerShots)) { playerShots.push(shot); shot.setVisible(true); crosshair.setVisible(false); @@ -232,7 +234,7 @@ export default (function() { opponentShots.concat(playerShots).forEach(function(shot) { shot.destroy(); }); - + /* falls through */ case 'start': /* falls through */ diff --git a/src/shot.js b/src/shot.js index a4c02aa..35081ad 100644 --- a/src/shot.js +++ b/src/shot.js @@ -39,7 +39,7 @@ export default (function() { function checkNotIntersecting(otherShot) { /* jshint validthis:true */ - + return (this.pos[0] !== otherShot.pos[0] || this.pos[1] !== otherShot.pos[1]); }