From 3208d230bf0b16e44ba9c2d8c4bbd6b8f847226c Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Mon, 11 Apr 2016 17:00:27 -0600 Subject: [PATCH] Prevent moving ship if inventory screen is open. Also resize map. --- loadRooms.js | 4 ++-- prefabs/shipPrefab.js | 25 ++++++++++++++----------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/loadRooms.js b/loadRooms.js index 4702488..530b1de 100644 --- a/loadRooms.js +++ b/loadRooms.js @@ -1,8 +1,8 @@ // var rm_TitleScreen = OS.R.Add("Default"); // var rm_Ocean = OS.R.Add("Ocean", { var rm_Ocean = OS.R.Add("Default", { - width: (64 * OS.S.pixelScale) * 64, //32 64x64 squares for the map. - height: (64 * OS.S.pixelScale) * 64, + width: (64 * OS.S.pixelScale) * 50, //50x50 map of 64x64 squares. This will allow a single pixel on the map to represent a 64x square and fit comfortably on screen. + height: (64 * OS.S.pixelScale) * 50, backgroundColor: "#1b2632" }); diff --git a/prefabs/shipPrefab.js b/prefabs/shipPrefab.js index 8c9b1fa..bc0e323 100644 --- a/prefabs/shipPrefab.js +++ b/prefabs/shipPrefab.js @@ -27,19 +27,22 @@ var pr_ship = OS.P.Add("Ship", { }); pr_ship.Do = function () { - if (ct_left().down) { - this.direction += 45; - } else if (ct_right().down) { - this.direction -= 45; + if (!guiControl.inventory.show) { + if (ct_left().down) { + this.direction += 45; + } else if (ct_right().down) { + this.direction -= 45; + } + this.direction = Math.clampAngle(this.direction); + + if (ct_up().down) { + this.currentSpeed++; + } else if (ct_down().down) { + this.currentSpeed--; + } + this.AdjustSpeedBasedOnEnergy(); } - this.direction = Math.clampAngle(this.direction); - if (ct_up().down) { - this.currentSpeed++; - } else if (ct_down().down) { - this.currentSpeed--; - } - this.AdjustSpeedBasedOnEnergy(); this.currentSpeed = Math.clamp(this.currentSpeed, 0, 4); this.moveStepProgress += this.currentSpeed * this.moveStepAmount;