From 2c1084d838fd3666f47fd58591700202c6c6140c Mon Sep 17 00:00:00 2001 From: Greta Krafsig Date: Thu, 15 Oct 2015 14:54:26 -0400 Subject: [PATCH] move player through doorways so arrow keys and clicking works --- client/js/game.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/client/js/game.js b/client/js/game.js index da4d0701f..831836bae 100644 --- a/client/js/game.js +++ b/client/js/game.js @@ -959,12 +959,21 @@ function(InfoManager, BubbleManager, Renderer, Map, Animation, Sprite, AnimatedT if(!self.player.hasTarget() && self.map.isDoor(x, y)) { var dest = self.map.getDoorDestination(x, y); + var desty = dest.y; + + //push them off the door spot so they can use the + //arrow keys and mouse to walk back in or out + if (dest.orientation === Types.Orientations.UP) { + desty--; + } else if (dest.orientation === Types.Orientations.DOWN) { + desty++; + } - self.player.setGridPosition(dest.x, dest.y); + self.player.setGridPosition(dest.x, desty); self.player.nextGridX = dest.x; - self.player.nextGridY = dest.y; + self.player.nextGridY = desty; self.player.turnTo(dest.orientation); - self.client.sendTeleport(dest.x, dest.y); + self.client.sendTeleport(dest.x, desty); if(self.renderer.mobile && dest.cameraX && dest.cameraY) { self.camera.setGridPosition(dest.cameraX, dest.cameraY);