diff --git a/gui/inventoryGUI.js b/gui/inventoryGUI.js index 92a0014..c7f670c 100644 --- a/gui/inventoryGUI.js +++ b/gui/inventoryGUI.js @@ -1,217 +1,221 @@ function inventoryGUI() { - if (Oversimplified.DEBUG.showMessages) console.log("Ran inventoryGUI()"); + if (Oversimplified.DEBUG.showMessages) console.log("Ran inventoryGUI()"); } guiControl.inventory = { - screen: "main", - cursorPosition: 0, - show: false, - activateDelay: 0 + screen: "main", + cursorPosition: 0, + show: false, + activateDelay: 0, } guiControl.inventory.Draw = function () { - if (guiControl.inventory && guiControl.inventory.show) { - guiControl.inventory.activateDelay -= (guiControl.inventory.activateDelay > 0) ? 1 : 0; + if (guiControl.inventory && guiControl.inventory.show) { + guiControl.inventory.activateDelay -= (guiControl.inventory.activateDelay > 0) ? 1 : 0; - guiControl.drawGUIBackground(); + guiControl.drawGUIBackground(); - if (ct_down().down) { - snd_cursordown.Play(); - guiControl.inventory.cursorPosition++; - } - if (ct_up().down) { - snd_cursordown.Play(); - guiControl.inventory.cursorPosition--; - } - - if (guiControl.inventory.screen == "main") { - // Limit Cursor - if (guiControl.inventory.cursorPosition < 0) { - guiControl.inventory.cursorPosition = 3; - } - if (guiControl.inventory.cursorPosition > 3) { - guiControl.inventory.cursorPosition = 0; - } + if (ct_down().down) { + snd_cursordown.Play(); + guiControl.inventory.cursorPosition++; + } + if (ct_up().down) { + snd_cursordown.Play(); + guiControl.inventory.cursorPosition--; + } + + if (guiControl.inventory.screen == "main") { + // Limit Cursor + if (guiControl.inventory.cursorPosition < 0) { + guiControl.inventory.cursorPosition = 3; + } + if (guiControl.inventory.cursorPosition > 3) { + guiControl.inventory.cursorPosition = 0; + } - // Title - guiControl.drawPixelText("Storage", guiControl.leftBorder - pixel(2), guiControl.topOfBackground, 8, "black", 6); + // Title + guiControl.drawPixelText("Storage", guiControl.leftBorder - pixel(2), guiControl.topOfBackground, 8, "black", 6); - guiControl.drawPageArrow("left", pixel(4), guiControl.topOfBackground); - guiControl.drawPageArrow("right", OS.camera.width - pixel(4) - pixel(4), guiControl.topOfBackground); + guiControl.drawPageArrow("left", pixel(4), guiControl.topOfBackground); + guiControl.drawPageArrow("right", OS.camera.width - pixel(4) - pixel(4), guiControl.topOfBackground); - // Money icon - guiControl.drawIcon(7, 2, guiControl.leftBorder, guiControl.rowTop(0)); - guiControl.drawPixelText(G.inventory.moneyDisplay(), guiControl.leftBorder + pixel(guiControl.iconSize + 4), guiControl.rowTop(0) + pixel(), 8, "black", 6); - // Cargo icon - guiControl.drawIcon(1, 0, guiControl.leftBorder, guiControl.rowTop(1)); - guiControl.drawPixelText(G.inventory.CargoTotal().toString(), guiControl.leftBorder + pixel(guiControl.iconSize + 4), guiControl.rowTop(1) + pixel(), 8, "black", 6); - // Stats icon - // guiControl.drawIcon(9, 2, guiControl.leftBorder, guiControl.rowTop(2)); - guiControl.drawPixelText("Status", guiControl.leftBorder, guiControl.rowTop(2) + pixel(), 8, "black", 6); - - // Close Text - guiControl.drawPixelText("Close", guiControl.leftBorder, guiControl.rowTop(3) + pixel(), 8, "black", 6); - - // Draw cursor - guiControl.drawCursor(guiControl.leftBorder - (guiControl.iconScaled), guiControl.rowTop(guiControl.inventory.cursorPosition)); + // Money icon + guiControl.drawIcon(7, 2, guiControl.leftBorder, guiControl.rowTop(0)); + guiControl.drawPixelText(G.inventory.moneyDisplay(), guiControl.leftBorder + pixel(guiControl.iconSize + 4), guiControl.rowTop(0) + pixel(), 8, "black", 6); + // Cargo icon + guiControl.drawIcon(1, 0, guiControl.leftBorder, guiControl.rowTop(1)); + guiControl.drawPixelText(G.inventory.CargoTotal().toString(), guiControl.leftBorder + pixel(guiControl.iconSize + 4), guiControl.rowTop(1) + pixel(), 8, "black", 6); + // Stats icon + // guiControl.drawIcon(9, 2, guiControl.leftBorder, guiControl.rowTop(2)); + guiControl.drawPixelText("Status", guiControl.leftBorder, guiControl.rowTop(2) + pixel(), 8, "black", 6); + + // Close Text + guiControl.drawPixelText("Close", guiControl.leftBorder, guiControl.rowTop(3) + pixel(), 8, "black", 6); + + // Draw cursor + guiControl.drawCursor(guiControl.leftBorder - (guiControl.iconScaled), guiControl.rowTop(guiControl.inventory.cursorPosition)); - // Button Action - if (guiControl.inventory.activateDelay <= 0) { - if (ct_confirm().down) { - switch (guiControl.inventory.cursorPosition) { - case 0: - snd_select.Play(); - guiControl.inventory.screen = "money"; + // Button Action + if (guiControl.inventory.activateDelay <= 0) { + if (ct_confirm().down) { + switch (guiControl.inventory.cursorPosition) { + case 0: { + snd_select.Play(); + guiControl.inventory.screen = "money"; break; - case 1: - snd_select.Play(); - guiControl.inventory.screen = "cargo"; + } + case 1: { + snd_select.Play(); + guiControl.inventory.screen = "cargo"; break; - case 2: - snd_select.Play(); - guiControl.inventory.screen = "status"; + } + case 2: { + snd_select.Play(); + guiControl.inventory.screen = "status"; break; - default: - snd_cursorup.Play(); - guiControl.inventory.show = false; + } + default: { + snd_cursorup.Play(); + guiControl.inventory.show = false; break; - } + } + } - guiControl.inventory.cursorPosition = 0; - guiControl.inventory.activateDelay = 5; - } - if (ct_cancel().down) { - snd_cursorup.Play(); - guiControl.inventory.show = false; - } - if (ct_left().down) { - snd_cursordown.Play(); - guiControl.inventory.show = false; - guiControl.map.activateDelay = 5; - guiControl.map.show = true; - } - if (ct_right().down) { - snd_cursordown.Play(); - guiControl.inventory.show = false; - guiControl.map.activateDelay = 5; - guiControl.map.show = true; - } - } - } - else if (guiControl.inventory.screen == "money") { - // Limit Cursor - if (guiControl.inventory.cursorPosition < 0) { - guiControl.inventory.cursorPosition = 0; - } - if (guiControl.inventory.cursorPosition > 0) { - guiControl.inventory.cursorPosition = 0; - } + guiControl.inventory.cursorPosition = 0; + guiControl.inventory.activateDelay = 5; + } + if (ct_cancel().down) { + snd_cursorup.Play(); + guiControl.inventory.show = false; + } + if (ct_left().down) { + snd_cursordown.Play(); + guiControl.inventory.show = false; + guiControl.map.activateDelay = 5; + guiControl.map.show = true; + } + if (ct_right().down) { + snd_cursordown.Play(); + guiControl.inventory.show = false; + guiControl.map.activateDelay = 5; + guiControl.map.show = true; + } + } + } + else if (guiControl.inventory.screen == "money") { + // Limit Cursor + if (guiControl.inventory.cursorPosition < 0) { + guiControl.inventory.cursorPosition = 0; + } + if (guiControl.inventory.cursorPosition > 0) { + guiControl.inventory.cursorPosition = 0; + } - // Title - guiControl.drawPixelText("Money", guiControl.leftBorder + pixel(3), guiControl.topOfBackground, 8, "black", 6); + // Title + guiControl.drawPixelText("Money", guiControl.leftBorder + pixel(3), guiControl.topOfBackground, 8, "black", 6); - guiControl.drawPixelText("Actual Amt", guiControl.leftBorder - pixel(5), guiControl.rowTop(0) + pixel(), 10, "black", 4); - // Money icon - guiControl.drawIcon(7, 2, guiControl.leftBorder - pixel(5), guiControl.rowTop(1) - pixel(3)); - guiControl.drawPixelText(G.inventory.money.toString(), guiControl.leftBorder - pixel(5) + pixel(guiControl.iconSize + 2), guiControl.rowTop(1) + pixel(2) - pixel(3), 10, "black", 4); - - // Back Text - guiControl.drawPixelText("Back", guiControl.leftBorder, guiControl.rowTop(4) - pixel(3), 8, "black", 6); - - // Draw cursor - guiControl.drawCursor(guiControl.leftBorder - (guiControl.iconScaled), guiControl.rowTop(4) - pixel(4)); + guiControl.drawPixelText("Actual Amt", guiControl.leftBorder - pixel(5), guiControl.rowTop(0) + pixel(), 10, "black", 4); + // Money icon + guiControl.drawIcon(7, 2, guiControl.leftBorder - pixel(5), guiControl.rowTop(1) - pixel(3)); + guiControl.drawPixelText(G.inventory.money.toString(), guiControl.leftBorder - pixel(5) + pixel(guiControl.iconSize + 2), guiControl.rowTop(1) + pixel(2) - pixel(3), 10, "black", 4); + + // Back Text + guiControl.drawPixelText("Back", guiControl.leftBorder, guiControl.rowTop(4) - pixel(3), 8, "black", 6); + + // Draw cursor + guiControl.drawCursor(guiControl.leftBorder - (guiControl.iconScaled), guiControl.rowTop(4) - pixel(4)); - // Button Action - if (guiControl.inventory.activateDelay <= 0) { - if (ct_confirm().down || ct_cancel().down) { - snd_cursorup.Play(); - guiControl.inventory.screen = "main"; - guiControl.inventory.activateDelay = 5; - guiControl.inventory.cursorPosition = 0; - } - } - } - else if (guiControl.inventory.screen == "cargo") { - // Limit Cursor - if (guiControl.inventory.cursorPosition < 0) { - guiControl.inventory.cursorPosition = 0; - } - if (guiControl.inventory.cursorPosition > 0) { - guiControl.inventory.cursorPosition = 0; - } + // Button Action + if (guiControl.inventory.activateDelay <= 0) { + if (ct_confirm().down || ct_cancel().down) { + snd_cursorup.Play(); + guiControl.inventory.screen = "main"; + guiControl.inventory.activateDelay = 5; + guiControl.inventory.cursorPosition = 0; + } + } + } + else if (guiControl.inventory.screen == "cargo") { + // Limit Cursor + if (guiControl.inventory.cursorPosition < 0) { + guiControl.inventory.cursorPosition = 0; + } + if (guiControl.inventory.cursorPosition > 0) { + guiControl.inventory.cursorPosition = 0; + } - // Title - guiControl.drawPixelText("Cargo", guiControl.leftBorder + pixel(3), guiControl.topOfBackground, 8, "black", 6); + // Title + guiControl.drawPixelText("Cargo", guiControl.leftBorder + pixel(3), guiControl.topOfBackground, 8, "black", 6); - // Cargo icons - var cargo = G.inventory.CheckCargo(); // Contains the item ids that have more than 1 item - for (var i = 0; i < cargo.length; i++) { - guiControl.drawItem(cargo[i], guiControl.leftBorder, guiControl.rowTop(i)); - guiControl.drawPixelText(G.inventory.cargo[cargo[i]], guiControl.leftBorder + pixel(guiControl.iconSize + 4), guiControl.rowTop(i) + pixel(), 8, "black", 6); - } + // Cargo icons + var cargo = G.inventory.CheckCargo(); // Contains the item ids that have more than 1 item + for (var i = 0; i < cargo.length; i++) { + guiControl.drawItem(cargo[i], guiControl.leftBorder, guiControl.rowTop(i)); + guiControl.drawPixelText(G.inventory.cargo[cargo[i]], guiControl.leftBorder + pixel(guiControl.iconSize + 4), guiControl.rowTop(i) + pixel(), 8, "black", 6); + } - // Back Text - guiControl.drawPixelText("Back", guiControl.leftBorder, guiControl.rowTop(4) - pixel(3), 8, "black", 6); - - // Draw cursor - guiControl.drawCursor(guiControl.leftBorder - (guiControl.iconScaled), guiControl.rowTop(4) - pixel(4)); + // Back Text + guiControl.drawPixelText("Back", guiControl.leftBorder, guiControl.rowTop(4) - pixel(3), 8, "black", 6); + + // Draw cursor + guiControl.drawCursor(guiControl.leftBorder - (guiControl.iconScaled), guiControl.rowTop(4) - pixel(4)); - // Button Action - if (guiControl.inventory.activateDelay <= 0) { - if (ct_confirm().down || ct_cancel().down) { - snd_cursorup.Play(); - guiControl.inventory.screen = "main"; - guiControl.inventory.activateDelay = 5; - guiControl.inventory.cursorPosition = 1; - } - } - } - else if (guiControl.inventory.screen == "status") { - // Limit Cursor - if (guiControl.inventory.cursorPosition < 0) { - guiControl.inventory.cursorPosition = 0; - } - if (guiControl.inventory.cursorPosition > 0) { - guiControl.inventory.cursorPosition = 0; - } + // Button Action + if (guiControl.inventory.activateDelay <= 0) { + if (ct_confirm().down || ct_cancel().down) { + snd_cursorup.Play(); + guiControl.inventory.screen = "main"; + guiControl.inventory.activateDelay = 5; + guiControl.inventory.cursorPosition = 1; + } + } + } + else if (guiControl.inventory.screen == "status") { + // Limit Cursor + if (guiControl.inventory.cursorPosition < 0) { + guiControl.inventory.cursorPosition = 0; + } + if (guiControl.inventory.cursorPosition > 0) { + guiControl.inventory.cursorPosition = 0; + } - // guiControl.drawPageArrow("left", pixel(4), guiControl.topOfBackground); - // guiControl.drawPageArrow("right", OS.camera.width - pixel(4) - pixel(4), guiControl.topOfBackground); + // guiControl.drawPageArrow("left", pixel(4), guiControl.topOfBackground); + // guiControl.drawPageArrow("right", OS.camera.width - pixel(4) - pixel(4), guiControl.topOfBackground); - // Title - guiControl.drawPixelText("Status", guiControl.leftBorder + pixel(), guiControl.topOfBackground, 8, "black", 6); + // Title + guiControl.drawPixelText("Status", guiControl.leftBorder + pixel(), guiControl.topOfBackground, 8, "black", 6); - // Illness icon - guiControl.drawIcon(4, 1, guiControl.leftBorder - pixel(6), guiControl.rowTop(0)); - guiControl.drawPixelText(G.stats.illness.toString(), guiControl.leftBorder - pixel(6) + (guiControl.iconScaled + pixel(2)), guiControl.rowTop(0) + pixel(2), 2, "black", 4); - - guiControl.drawPixelText("This will show more data when stati can change.", guiControl.leftBorder - pixel(5), guiControl.rowTop(1), 10, "black", 4); - /*// Energy icon - guiControl.drawIcon(9, 2, guiControl.leftBorder - pixel(5), guiControl.rowTop(0) - pixel(3)); - guiControl.drawPixelText(G.stats.energy.toString(), guiControl.leftBorder - pixel(5) + pixel(guiControl.iconSize + 2), guiControl.rowTop(1) + pixel(2) - pixel(3), 2, "black", 4); - // Illness icon - guiControl.drawIcon(4, 1, guiControl.leftBorder - pixel(5) + pixel(24), guiControl.rowTop(1) - pixel(3)); - guiControl.drawPixelText(G.stats.illness.toString(), guiControl.leftBorder - pixel(5) + pixel(24) + pixel(guiControl.iconSize + 2), guiControl.rowTop(1) + pixel(2) - pixel(3), 2, "black", 4); + // Illness icon + guiControl.drawIcon(4, 1, guiControl.leftBorder - pixel(6), guiControl.rowTop(0)); + guiControl.drawPixelText(G.stats.illness.toString(), guiControl.leftBorder - pixel(6) + (guiControl.iconScaled + pixel(2)), guiControl.rowTop(0) + pixel(2), 2, "black", 4); + + guiControl.drawPixelText("This will show more data when stati can change.", guiControl.leftBorder - pixel(5), guiControl.rowTop(1), 10, "black", 4); + /*// Energy icon + guiControl.drawIcon(9, 2, guiControl.leftBorder - pixel(5), guiControl.rowTop(0) - pixel(3)); + guiControl.drawPixelText(G.stats.energy.toString(), guiControl.leftBorder - pixel(5) + pixel(guiControl.iconSize + 2), guiControl.rowTop(1) + pixel(2) - pixel(3), 2, "black", 4); + // Illness icon + guiControl.drawIcon(4, 1, guiControl.leftBorder - pixel(5) + pixel(24), guiControl.rowTop(1) - pixel(3)); + guiControl.drawPixelText(G.stats.illness.toString(), guiControl.leftBorder - pixel(5) + pixel(24) + pixel(guiControl.iconSize + 2), guiControl.rowTop(1) + pixel(2) - pixel(3), 2, "black", 4); - // Yes/No options - guiControl.drawPixelText("No", guiControl.leftBorder, guiControl.rowTop(2) - pixel(3), 3, "black", 6); - guiControl.drawPixelText("Yes", guiControl.leftBorder, guiControl.rowTop(3) - pixel(3), 3, (G.inventory.supplies > 0 && G.stats.illness > 0) ? "black" : "white", 6); - */ - // Back Text - guiControl.drawPixelText("Back", guiControl.leftBorder, guiControl.rowTop(4) - pixel(3), 8, "black", 6); - - // Draw cursor - guiControl.drawCursor(guiControl.leftBorder - (guiControl.iconScaled), guiControl.rowTop(4) - pixel(3)); + // Yes/No options + guiControl.drawPixelText("No", guiControl.leftBorder, guiControl.rowTop(2) - pixel(3), 3, "black", 6); + guiControl.drawPixelText("Yes", guiControl.leftBorder, guiControl.rowTop(3) - pixel(3), 3, (G.inventory.supplies > 0 && G.stats.illness > 0) ? "black" : "white", 6); + */ + // Back Text + guiControl.drawPixelText("Back", guiControl.leftBorder, guiControl.rowTop(4) - pixel(3), 8, "black", 6); + + // Draw cursor + guiControl.drawCursor(guiControl.leftBorder - (guiControl.iconScaled), guiControl.rowTop(4) - pixel(3)); - // Button Action - if (guiControl.inventory.activateDelay <= 0) { - if (ct_confirm().down || ct_cancel().down) { - snd_cursorup.Play(); - guiControl.inventory.screen = "main"; - guiControl.inventory.activateDelay = 5; - guiControl.inventory.cursorPosition = 2; // The position where "Supplies" is on main screen. - } - } - } - } + // Button Action + if (guiControl.inventory.activateDelay <= 0) { + if (ct_confirm().down || ct_cancel().down) { + snd_cursorup.Play(); + guiControl.inventory.screen = "main"; + guiControl.inventory.activateDelay = 5; + guiControl.inventory.cursorPosition = 2; // The position where "Supplies" is on main screen. + } + } + } + } } diff --git a/gui/mapGUI.js b/gui/mapGUI.js index a5370e4..b3b951a 100644 --- a/gui/mapGUI.js +++ b/gui/mapGUI.js @@ -1,62 +1,62 @@ function mapGUI() { - if (Oversimplified.DEBUG.showMessages) console.log("Ran mapGUI()"); + if (Oversimplified.DEBUG.showMessages) console.log("Ran mapGUI()"); } guiControl.map = { - show: false, - activateDelay: 0 + show: false, + activateDelay: 0, } guiControl.map.Draw = function () { - if (guiControl.map && guiControl.map.show) { - guiControl.map.activateDelay -= (guiControl.map.activateDelay > 0) ? 1 : 0; + if (guiControl.map && guiControl.map.show) { + guiControl.map.activateDelay -= (guiControl.map.activateDelay > 0) ? 1 : 0; - guiControl.drawGUIBackground(); - - // Title - guiControl.drawPixelText("Map", guiControl.leftBorder + pixel(10), guiControl.topOfBackground, 8, "black", 6); + guiControl.drawGUIBackground(); + + // Title + guiControl.drawPixelText("Map", guiControl.leftBorder + pixel(10), guiControl.topOfBackground, 8, "black", 6); - guiControl.drawPageArrow("left", pixel(4), guiControl.topOfBackground); - guiControl.drawPageArrow("right", OS.camera.width - pixel(4) - pixel(4), guiControl.topOfBackground); + guiControl.drawPageArrow("left", pixel(4), guiControl.topOfBackground); + guiControl.drawPageArrow("right", OS.camera.width - pixel(4) - pixel(4), guiControl.topOfBackground); - var saveFillStyle = OS.context.fillStyle; + var saveFillStyle = OS.context.fillStyle; - var mapLeft = guiControl.leftBorder - pixel(5); - var mapTop = guiControl.upperBorder; + var mapLeft = guiControl.leftBorder - pixel(5); + var mapTop = guiControl.upperBorder; - OS.context.fillStyle = "#0000CC"; - OS.context.fillRect(mapLeft, mapTop, pixel(50), pixel(45)); + OS.context.fillStyle = "#0000CC"; + OS.context.fillRect(mapLeft, mapTop, pixel(50), pixel(45)); - OS.context.fillStyle = "#00FF00"; - for (var m = 0; m < G.map.length; m++) { - var pixelLeft = mapLeft + pixel(G.map[m].drawX); - var pixelTop = mapTop + pixel(G.map[m].drawY); - OS.context.fillRect(pixelLeft, pixelTop, pixel(), pixel()); - } + OS.context.fillStyle = "#00FF00"; + for (var m = 0; m < G.map.length; m++) { + var pixelLeft = mapLeft + pixel(G.map[m].drawX); + var pixelTop = mapTop + pixel(G.map[m].drawY); + OS.context.fillRect(pixelLeft, pixelTop, pixel(), pixel()); + } - OS.context.fillStyle = "#FF0000"; - OS.context.fillRect(mapLeft + G.player.mapX, mapTop + G.player.mapY, pixel(), pixel()); + OS.context.fillStyle = "#FF0000"; + OS.context.fillRect(mapLeft + G.player.mapX, mapTop + G.player.mapY, pixel(), pixel()); - OS.context.fillStyle = saveFillStyle; - - // Button Action - if (guiControl.map.activateDelay <= 0) { - if (ct_confirm().down || ct_cancel().down || ct_m.down) { - snd_cursorup.Play(); - guiControl.map.show = false; - } - if (ct_left().down) { - snd_cursordown.Play(); - guiControl.map.show = false; - guiControl.inventory.activateDelay = 5; - guiControl.inventory.show = true; - } - if (ct_right().down) { - snd_cursordown.Play(); - guiControl.map.show = false; - guiControl.inventory.activateDelay = 5; - guiControl.inventory.show = true; - } - } - } + OS.context.fillStyle = saveFillStyle; + + // Button Action + if (guiControl.map.activateDelay <= 0) { + if (ct_confirm().down || ct_cancel().down || ct_m.down) { + snd_cursorup.Play(); + guiControl.map.show = false; + } + if (ct_left().down) { + snd_cursordown.Play(); + guiControl.map.show = false; + guiControl.inventory.activateDelay = 5; + guiControl.inventory.show = true; + } + if (ct_right().down) { + snd_cursordown.Play(); + guiControl.map.show = false; + guiControl.inventory.activateDelay = 5; + guiControl.inventory.show = true; + } + } + } } diff --git a/gui/titleScreen.js b/gui/titleScreen.js index 19589c8..0ef3f82 100644 --- a/gui/titleScreen.js +++ b/gui/titleScreen.js @@ -3,111 +3,114 @@ function titleScreen () { } guiControl.title = { - screen: "main", - show: true, - cursorPosition: 0, - activateDelay: 0, + screen: "main", + show: true, + cursorPosition: 0, + activateDelay: 0, - padding: pixel(2), - leftBorder: pixel(12), + padding: pixel(2), + leftBorder: pixel(12), - rowTop: function (rowNumber) { - return pixel(32) + pixel(2) + pixel((guiControl.iconSize + 2) * rowNumber); - } + rowTop: function (rowNumber) { + return pixel(32) + pixel(2) + pixel((guiControl.iconSize + 2) * rowNumber); + }, } guiControl.title.Draw = function () { - if (guiControl.title && guiControl.title.show) { - guiControl.title.activateDelay -= (guiControl.title.activateDelay > 0) ? 1 : 0; + if (guiControl.title && guiControl.title.show) { + guiControl.title.activateDelay -= (guiControl.title.activateDelay > 0) ? 1 : 0; - if (guiControl.title.screen == "main") { - if (ct_down().down) { - snd_cursordown.Play(); - guiControl.title.cursorPosition++; + if (guiControl.title.screen == "main") { + if (ct_down().down) { + snd_cursordown.Play(); + guiControl.title.cursorPosition++; + } + if (ct_up().down) { + snd_cursordown.Play(); + guiControl.title.cursorPosition--; + } + + // console.log(guiControl.title.screen); + // Limit Cursor + if (guiControl.title.cursorPosition < 0) { + guiControl.title.cursorPosition = 2; + } + if (guiControl.title.cursorPosition > 2) { + guiControl.title.cursorPosition = 0; + } + + // Title + guiControl.drawTitleImage(); + + // New Game + guiControl.drawPixelText("New Game", guiControl.title.leftBorder, guiControl.title.rowTop(0), 10, "white", 6); + // Load Game + guiControl.drawPixelText("Continue", guiControl.title.leftBorder, guiControl.title.rowTop(1), 10, (G.savedGameExists) ? "white" : "black", 6); + // Options + guiControl.drawPixelText("Options", guiControl.title.leftBorder, guiControl.title.rowTop(2) + pixel(), 8, (guiControl.optionsScreen) ? "white" : "black", 6); + + // Draw cursor + guiControl.drawCursor(guiControl.title.leftBorder - (guiControl.iconScaled), guiControl.title.rowTop(guiControl.title.cursorPosition)); + + // Button Action + if (guiControl.title.activateDelay <= 0) { + if (ct_confirm().down) { + switch (guiControl.title.cursorPosition) { + case 0: { + snd_select.Play(); + mus_title.Stop(); + mus_sail.Play(); + guiControl.title.show = false; + G.gameStarted = true; + G.SaveGame(); + break; } - if (ct_up().down) { - snd_cursordown.Play(); - guiControl.title.cursorPosition--; + case 1: { + if (G.savedGameExists) { // once loading is in, allow this. + G.LoadGame(); + snd_select.Play(); + mus_title.Stop(); + mus_sail.Play(); + guiControl.title.show = false; + G.gameStarted = true; + } else { + snd_cannotbuy.Play(); + } + break; } - - // console.log(guiControl.title.screen); - // Limit Cursor - if (guiControl.title.cursorPosition < 0) { - guiControl.title.cursorPosition = 2; - } - if (guiControl.title.cursorPosition > 2) { - guiControl.title.cursorPosition = 0; + case 2: { + if (false) { // once loading is in, allow this. + snd_select.Play(); + guiControl.title.show = false; + guiControl.options.show = true; + break; + } else { + snd_cannotbuy.Play(); + } } + } - // Title - guiControl.drawTitleImage(); - - // New Game - guiControl.drawPixelText("New Game", guiControl.title.leftBorder, guiControl.title.rowTop(0), 10, "white", 6); - // Load Game - guiControl.drawPixelText("Continue", guiControl.title.leftBorder, guiControl.title.rowTop(1), 10, (G.savedGameExists) ? "white" : "black", 6); - // Options - guiControl.drawPixelText("Options", guiControl.title.leftBorder, guiControl.title.rowTop(2) + pixel(), 8, (guiControl.optionsScreen) ? "white" : "black", 6); - - // Draw cursor - guiControl.drawCursor(guiControl.title.leftBorder - (guiControl.iconScaled), guiControl.title.rowTop(guiControl.title.cursorPosition)); - - // Button Action - if (guiControl.title.activateDelay <= 0) { - if (ct_confirm().down) { - switch (guiControl.title.cursorPosition) { - case 0: - snd_select.Play(); - mus_title.Stop(); - mus_sail.Play(); - guiControl.title.show = false; - G.gameStarted = true; - G.SaveGame(); - break; - case 1: - if (G.savedGameExists) { // once loading is in, allow this. - G.LoadGame(); - snd_select.Play(); - mus_title.Stop(); - mus_sail.Play(); - guiControl.title.show = false; - G.gameStarted = true; - } else { - snd_cannotbuy.Play(); - } - break; - case 2: - if (false) { // once loading is in, allow this. - snd_select.Play(); - guiControl.title.show = false; - guiControl.options.show = true; - break; - } else { - snd_cannotbuy.Play(); - } - } - - guiControl.title.cursorPosition = 0; - // console.log(guiControl.title.screen); - } - - if (ct_cancel().down) { - guiControl.title.screen = "credits"; - } - } + guiControl.title.cursorPosition = 0; + // console.log(guiControl.title.screen); } - else if (guiControl.title.screen == "credits") { - guiControl.drawPixelText("Credits", guiControl.title.leftBorder - pixel(), pixel(2), 0, "white", 6); - guiControl.drawPixelText("Music, Icons", pixel(), pixel(11), 0, "white", 4); - guiControl.drawPixelText("Paws Menu", pixel(2), pixel(17), 0, "yellow", 6); - guiControl.drawPixelText("paws.bandcamp.com", pixel(2), pixel(25), 0, "yellow", 4); - guiControl.drawPixelText("Evrthng Else", pixel(), pixel(39), 0, "white", 4); - guiControl.drawPixelText("Alamantus", pixel(2), pixel(45), 0, "yellow", 6); - guiControl.drawPixelText("alamantus.com", pixel(2), pixel(53), 0, "yellow", 4); - if (ct_confirm().down || ct_cancel().down || ct_esc.down) { - guiControl.title.screen = "main"; - } + if (ct_cancel().down) { + guiControl.title.screen = "credits"; } + } } + else if (guiControl.title.screen == "credits") { + guiControl.drawPixelText("Credits", guiControl.title.leftBorder - pixel(), pixel(2), 0, "white", 6); + guiControl.drawPixelText("Music, Icons", pixel(), pixel(11), 0, "white", 4); + guiControl.drawPixelText("Paws Menu", pixel(2), pixel(17), 0, "yellow", 6); + guiControl.drawPixelText("paws.bandcamp.com", pixel(2), pixel(25), 0, "yellow", 4); + guiControl.drawPixelText("Evrthng Else", pixel(), pixel(39), 0, "white", 4); + guiControl.drawPixelText("Alamantus", pixel(2), pixel(45), 0, "yellow", 6); + guiControl.drawPixelText("alamantus.com", pixel(2), pixel(53), 0, "yellow", 4); + + if (ct_confirm().down || ct_cancel().down || ct_esc.down) { + guiControl.title.screen = "main"; + } + } + } } diff --git a/gui/tradeGUI.js b/gui/tradeGUI.js index 8586b51..6a1d182 100644 --- a/gui/tradeGUI.js +++ b/gui/tradeGUI.js @@ -1,448 +1,461 @@ function tradeGUI() { - if (Oversimplified.DEBUG.showMessages) console.log("Ran tradeGUI()"); + if (Oversimplified.DEBUG.showMessages) console.log("Ran tradeGUI()"); } guiControl.trade = { - screen: "main", // "main", "buy", "sell", "gossip" - cursorPosition: 0, - page: 0, // horizontal page on item lists. Base 1 to match number of pages var "pages" within the gui. - itemsPerPage: 3, - show: false, - activateDelay: 0, + screen: "main", // "main", "buy", "sell", "gossip" + cursorPosition: 0, + page: 0, // horizontal page on item lists. Base 1 to match number of pages var "pages" within the gui. + itemsPerPage: 3, + show: false, + activateDelay: 0, - island: null, + island: null, - padding: pixel(2), - leftBorder: pixel(12), + padding: pixel(2), + leftBorder: pixel(12), - rowTop: function (rowNumber) { - return (guiControl.trade.padding + pixel(6) + (guiControl.trade.padding * 3)) + pixel((guiControl.iconSize + 3) * rowNumber); - } + rowTop: function (rowNumber) { + return (guiControl.trade.padding + pixel(6) + (guiControl.trade.padding * 3)) + pixel((guiControl.iconSize + 3) * rowNumber); + }, } guiControl.trade.Draw = function () { - if (guiControl.trade && guiControl.trade.show) { - guiControl.trade.activateDelay -= (guiControl.trade.activateDelay > 0) ? 1 : 0; - // console.log("trade screen island: " + guiControl.trade.island.name); - // Draw background color. - var tmp = Oversimplified.context.fillStyle; - Oversimplified.context.fillStyle = "#D9BEA5"; - Oversimplified.context.fillRect(0, 0, Oversimplified.camera.width, Oversimplified.camera.height); - Oversimplified.context.fillStyle = tmp; + if (guiControl.trade && guiControl.trade.show) { + guiControl.trade.activateDelay -= (guiControl.trade.activateDelay > 0) ? 1 : 0; + // console.log("trade screen island: " + guiControl.trade.island.name); + // Draw background color. + var tmp = Oversimplified.context.fillStyle; + Oversimplified.context.fillStyle = "#D9BEA5"; + Oversimplified.context.fillRect(0, 0, Oversimplified.camera.width, Oversimplified.camera.height); + Oversimplified.context.fillStyle = tmp; - if (ct_down().down) { - snd_cursordown.Play(); - guiControl.trade.cursorPosition++; - } - if (ct_up().down) { - snd_cursordown.Play(); - guiControl.trade.cursorPosition--; - } - if (ct_right().down) { - snd_cursordown.Play(); - guiControl.trade.page++; - } - if (ct_left().down) { - snd_cursordown.Play(); - guiControl.trade.page--; - } - - if (guiControl.trade.screen == "main") { - // console.log(guiControl.trade.screen); - // Limit Cursor - if (guiControl.trade.cursorPosition < 0) { - guiControl.trade.cursorPosition = 3; - } - if (guiControl.trade.cursorPosition > 3) { - guiControl.trade.cursorPosition = 0; - } - // Limit page - if (guiControl.trade.page < 0) { - guiControl.trade.page = 0; - } - if (guiControl.trade.page > 0) { - guiControl.trade.page = 0; - } + if (ct_down().down) { + snd_cursordown.Play(); + guiControl.trade.cursorPosition++; + } + if (ct_up().down) { + snd_cursordown.Play(); + guiControl.trade.cursorPosition--; + } + if (ct_right().down) { + snd_cursordown.Play(); + guiControl.trade.page++; + } + if (ct_left().down) { + snd_cursordown.Play(); + guiControl.trade.page--; + } + + if (guiControl.trade.screen == "main") { + // console.log(guiControl.trade.screen); + // Limit Cursor + if (guiControl.trade.cursorPosition < 0) { + guiControl.trade.cursorPosition = 3; + } + if (guiControl.trade.cursorPosition > 3) { + guiControl.trade.cursorPosition = 0; + } + // Limit page + if (guiControl.trade.page < 0) { + guiControl.trade.page = 0; + } + if (guiControl.trade.page > 0) { + guiControl.trade.page = 0; + } - // Title - guiControl.drawPixelText("On Island", (guiControl.trade.padding * 2), guiControl.trade.padding, 10, "black", 6); - // Money icon - // guiControl.drawIcon(7, 2, guiControl.trade.leftBorder, guiControl.trade.rowTop(0)); - guiControl.drawPixelText((guiControl.trade.island.CheckInventory().length > 0) ? "Buy" : "Sold Out!", guiControl.trade.leftBorder, guiControl.trade.rowTop(0) + pixel(), 10, (guiControl.trade.island.CheckInventory().length > 0) ? "black" : "white", 6); - // Supplies icon - // guiControl.drawIcon(9, 2, guiControl.trade.leftBorder, guiControl.trade.rowTop(1)); - guiControl.drawPixelText((G.inventory.CheckCargo().length > 0) ? "Sell" : "No Cargo!", guiControl.trade.leftBorder, guiControl.trade.rowTop(1) + pixel(), 10, (G.inventory.CheckCargo().length > 0) ? "black" : "white", 6); - // Cargo icon - // guiControl.drawIcon(1, 0, guiControl.trade.leftBorder, guiControl.trade.rowTop(2)); - guiControl.drawPixelText("Tavern", guiControl.trade.leftBorder, guiControl.trade.rowTop(2) + pixel(), 8, "black", 6); - - // Close Text - guiControl.drawPixelText("Leave", guiControl.trade.leftBorder, guiControl.trade.rowTop(3) + pixel(), 8, "black", 6); - - // Draw cursor - guiControl.drawCursor(guiControl.trade.leftBorder - (guiControl.iconScaled), guiControl.trade.rowTop(guiControl.trade.cursorPosition)); + // Title + guiControl.drawPixelText("On Island", (guiControl.trade.padding * 2), guiControl.trade.padding, 10, "black", 6); + // Money icon + // guiControl.drawIcon(7, 2, guiControl.trade.leftBorder, guiControl.trade.rowTop(0)); + guiControl.drawPixelText((guiControl.trade.island.CheckInventory().length > 0) ? "Buy" : "Sold Out!", guiControl.trade.leftBorder, guiControl.trade.rowTop(0) + pixel(), 10, (guiControl.trade.island.CheckInventory().length > 0) ? "black" : "white", 6); + // Supplies icon + // guiControl.drawIcon(9, 2, guiControl.trade.leftBorder, guiControl.trade.rowTop(1)); + guiControl.drawPixelText((G.inventory.CheckCargo().length > 0) ? "Sell" : "No Cargo!", guiControl.trade.leftBorder, guiControl.trade.rowTop(1) + pixel(), 10, (G.inventory.CheckCargo().length > 0) ? "black" : "white", 6); + // Cargo icon + // guiControl.drawIcon(1, 0, guiControl.trade.leftBorder, guiControl.trade.rowTop(2)); + guiControl.drawPixelText("Tavern", guiControl.trade.leftBorder, guiControl.trade.rowTop(2) + pixel(), 8, "black", 6); + + // Close Text + guiControl.drawPixelText("Leave", guiControl.trade.leftBorder, guiControl.trade.rowTop(3) + pixel(), 8, "black", 6); + + // Draw cursor + guiControl.drawCursor(guiControl.trade.leftBorder - (guiControl.iconScaled), guiControl.trade.rowTop(guiControl.trade.cursorPosition)); - // Button Action - if (guiControl.trade.activateDelay <= 0) { - if (ct_confirm().down) { - switch (guiControl.trade.cursorPosition) { - case 0: - if (guiControl.trade.island.CheckInventory().length > 0) { - snd_select.Play(); - guiControl.trade.screen = "buy"; - guiControl.trade.activateDelay = 5; - } - else { - snd_cannotbuy.Play(); - } + // Button Action + if (guiControl.trade.activateDelay <= 0) { + if (ct_confirm().down) { + switch (guiControl.trade.cursorPosition) { + case 0: { + if (guiControl.trade.island.CheckInventory().length > 0) { + snd_select.Play(); + guiControl.trade.screen = "buy"; + guiControl.trade.activateDelay = 5; + } + else { + snd_cannotbuy.Play(); + } break; - case 1: - if (G.inventory.CheckCargo().length > 0) { - snd_select.Play(); - guiControl.trade.screen = "sell"; - guiControl.trade.activateDelay = 5; - } else { - snd_cannotbuy.Play(); - } + } + case 1: { + if (G.inventory.CheckCargo().length > 0) { + snd_select.Play(); + guiControl.trade.screen = "sell"; + guiControl.trade.activateDelay = 5; + } else { + snd_cannotbuy.Play(); + } break; - case 2: - snd_select.Play(); - guiControl.trade.screen = "tavern"; - guiControl.trade.activateDelay = 5; + } + case 2: { + snd_select.Play(); + guiControl.trade.screen = "tavern"; + guiControl.trade.activateDelay = 5; break; - default: - snd_cursorup.Play(); - mus_trade.Stop(); - mus_sail.Play(); - guiControl.trade.show = false; + } + default: { + snd_cursorup.Play(); + mus_trade.Stop(); + mus_sail.Play(); + guiControl.trade.show = false; break; - } + } + } - // snd_select.Play(); - guiControl.trade.cursorPosition = 0; - guiControl.trade.page = 0; - // console.log(guiControl.trade.screen); - } - if (ct_cancel().down) { - snd_cursorup.Play(); - mus_trade.Stop(); - mus_sail.Play(); - guiControl.trade.show = false; - } - } - } - else if (guiControl.trade.screen == "buy") { - // console.log(guiControl.trade.screen); - // Limit Cursor - if (guiControl.trade.cursorPosition < 0) { - guiControl.trade.cursorPosition = 2; - } - if (guiControl.trade.cursorPosition > 2) { - guiControl.trade.cursorPosition = 0; - } + // snd_select.Play(); + guiControl.trade.cursorPosition = 0; + guiControl.trade.page = 0; + // console.log(guiControl.trade.screen); + } + if (ct_cancel().down) { + snd_cursorup.Play(); + mus_trade.Stop(); + mus_sail.Play(); + guiControl.trade.show = false; + } + } + } + else if (guiControl.trade.screen == "buy") { + // console.log(guiControl.trade.screen); + // Limit Cursor + if (guiControl.trade.cursorPosition < 0) { + guiControl.trade.cursorPosition = 2; + } + if (guiControl.trade.cursorPosition > 2) { + guiControl.trade.cursorPosition = 0; + } - // Title - guiControl.drawPixelText("Buy", guiControl.trade.leftBorder - pixel(2), guiControl.topOfBackground, 10, "black", 6); + // Title + guiControl.drawPixelText("Buy", guiControl.trade.leftBorder - pixel(2), guiControl.topOfBackground, 10, "black", 6); - // Money icon - guiControl.drawIcon(7, 2, guiControl.trade.padding, guiControl.trade.rowTop(0) - pixel(3)); - guiControl.drawPixelText(G.inventory.moneyDisplay(), guiControl.trade.padding + pixel(guiControl.iconSize + 2), guiControl.trade.rowTop(0) + pixel(2) - pixel(3), 10, "black", 4); - - // Cargo icons - var items = guiControl.trade.island.CheckInventory(); // Contains the item ids that have more than 1 item + // Money icon + guiControl.drawIcon(7, 2, guiControl.trade.padding, guiControl.trade.rowTop(0) - pixel(3)); + guiControl.drawPixelText(G.inventory.moneyDisplay(), guiControl.trade.padding + pixel(guiControl.iconSize + 2), guiControl.trade.rowTop(0) + pixel(2) - pixel(3), 10, "black", 4); + + // Cargo icons + var items = guiControl.trade.island.CheckInventory(); // Contains the item ids that have more than 1 item - // Limit page - if (guiControl.trade.page < 0) { - guiControl.trade.page = items.length - 1; - } - if (guiControl.trade.page > items.length - 1) { - guiControl.trade.page = 0; - } + // Limit page + if (guiControl.trade.page < 0) { + guiControl.trade.page = items.length - 1; + } + if (guiControl.trade.page > items.length - 1) { + guiControl.trade.page = 0; + } - if (items.length > 0) { - var itemPrice = G.economy.cargoItemWorth[items[guiControl.trade.page]] + guiControl.trade.island.priceDifferences[items[guiControl.trade.page]] - guiControl.trade.island.haggleAmount; - if (itemPrice < 1) itemPrice = 1; - var itemPriceDisplay = itemPrice.toString() + " c"; - guiControl.drawItem(items[guiControl.trade.page], guiControl.trade.leftBorder, guiControl.trade.rowTop(1) - pixel(5)); - guiControl.drawPixelText(itemPriceDisplay, guiControl.trade.leftBorder + pixel(guiControl.iconSize + 4), guiControl.trade.rowTop(1) - pixel(5) + pixel(), 8, "black", 6); + if (items.length > 0) { + var itemPrice = G.economy.cargoItemWorth[items[guiControl.trade.page]] + guiControl.trade.island.priceDifferences[items[guiControl.trade.page]] - guiControl.trade.island.haggleAmount; + if (itemPrice < 1) itemPrice = 1; + var itemPriceDisplay = itemPrice.toString() + " c"; + guiControl.drawItem(items[guiControl.trade.page], guiControl.trade.leftBorder, guiControl.trade.rowTop(1) - pixel(5)); + guiControl.drawPixelText(itemPriceDisplay, guiControl.trade.leftBorder + pixel(guiControl.iconSize + 4), guiControl.trade.rowTop(1) - pixel(5) + pixel(), 8, "black", 6); - if (items.length > 1) { - guiControl.drawPageArrow("left", guiControl.trade.padding, guiControl.trade.rowTop(1) - pixel(5)); - guiControl.drawPageArrow("right", OS.camera.width - pixel(4) - guiControl.trade.padding, guiControl.trade.rowTop(1) - pixel(5)); - } + if (items.length > 1) { + guiControl.drawPageArrow("left", guiControl.trade.padding, guiControl.trade.rowTop(1) - pixel(5)); + guiControl.drawPageArrow("right", OS.camera.width - pixel(4) - guiControl.trade.padding, guiControl.trade.rowTop(1) - pixel(5)); + } - // Amounts - guiControl.drawPixelText("Shop" + guiControl.trade.island.inventory[items[guiControl.trade.page]].toString(), OS.camera.width - pixel(20), guiControl.trade.rowTop(2) - pixel(6) + pixel(), 4, (guiControl.trade.island.CanBuyFrom(items[guiControl.trade.page], itemPrice)) ? "black" : "yellow", 4); - guiControl.drawPixelText("Own " + G.inventory.cargo[items[guiControl.trade.page]].toString(), OS.camera.width - pixel(20), guiControl.trade.rowTop(3) - pixel(6) + pixel(), 4, (G.inventory.cargo[items[guiControl.trade.page]] < G.stats.hold) ? "black" : "yellow", 4); - } else { - guiControl.drawPixelText("Sold Out!", guiControl.trade.leftBorder, guiControl.trade.rowTop(1) - pixel(5) + pixel(), 10, "black", 6); - } - - // Draw Amount of Cargo - guiControl.drawIcon(1, 1, OS.camera.width - pixel(20), guiControl.trade.rowTop(4) - pixel(5)); - guiControl.drawPixelText(G.inventory.CheckCargo().length.toString(), OS.camera.width - pixel(20) + (guiControl.iconScaled + pixel()), guiControl.trade.rowTop(4) - pixel(4), 4, (G.inventory.CheckCargo().length < G.stats.inventory) ? "black" : "yellow", 6); + // Amounts + guiControl.drawPixelText("Shop" + guiControl.trade.island.inventory[items[guiControl.trade.page]].toString(), OS.camera.width - pixel(20), guiControl.trade.rowTop(2) - pixel(6) + pixel(), 4, (guiControl.trade.island.CanBuyFrom(items[guiControl.trade.page], itemPrice)) ? "black" : "yellow", 4); + guiControl.drawPixelText("Own " + G.inventory.cargo[items[guiControl.trade.page]].toString(), OS.camera.width - pixel(20), guiControl.trade.rowTop(3) - pixel(6) + pixel(), 4, (G.inventory.cargo[items[guiControl.trade.page]] < G.stats.hold) ? "black" : "yellow", 4); + } else { + guiControl.drawPixelText("Sold Out!", guiControl.trade.leftBorder, guiControl.trade.rowTop(1) - pixel(5) + pixel(), 10, "black", 6); + } + + // Draw Amount of Cargo + guiControl.drawIcon(1, 1, OS.camera.width - pixel(20), guiControl.trade.rowTop(4) - pixel(5)); + guiControl.drawPixelText(G.inventory.CheckCargo().length.toString(), OS.camera.width - pixel(20) + (guiControl.iconScaled + pixel()), guiControl.trade.rowTop(4) - pixel(4), 4, (G.inventory.CheckCargo().length < G.stats.inventory) ? "black" : "yellow", 6); - // Yes/No Options - guiControl.drawPixelText("Haggle", guiControl.trade.leftBorder, guiControl.trade.rowTop(2) - pixel(2), 8, (guiControl.trade.island.timesHaggledToday >= G.stats.popularity) ? "yellow" : ((items.length > 0 && guiControl.trade.island.haggleAmount == 0) ? "black" : "white"), 6); - guiControl.drawPixelText((guiControl.trade.island.CanBuyFrom(items[guiControl.trade.page], itemPrice)) ? "Yes" : "Over!", guiControl.trade.leftBorder, guiControl.trade.rowTop(3) - pixel(2), 8, (items.length > 0 && G.inventory.CanBuy(items[guiControl.trade.page], itemPrice)) ? ((guiControl.trade.island.CanBuyFrom(items[guiControl.trade.page], itemPrice)) ? "black" : "yellow") : "white", 6); + // Yes/No Options + guiControl.drawPixelText("Haggle", guiControl.trade.leftBorder, guiControl.trade.rowTop(2) - pixel(2), 8, (guiControl.trade.island.timesHaggledToday >= G.stats.popularity) ? "yellow" : ((items.length > 0 && guiControl.trade.island.haggleAmount == 0) ? "black" : "white"), 6); + guiControl.drawPixelText((guiControl.trade.island.CanBuyFrom(items[guiControl.trade.page], itemPrice)) ? "Yes" : "Over!", guiControl.trade.leftBorder, guiControl.trade.rowTop(3) - pixel(2), 8, (items.length > 0 && G.inventory.CanBuy(items[guiControl.trade.page], itemPrice)) ? ((guiControl.trade.island.CanBuyFrom(items[guiControl.trade.page], itemPrice)) ? "black" : "yellow") : "white", 6); - // Back Text - guiControl.drawPixelText("Back", guiControl.trade.leftBorder, guiControl.trade.rowTop(4) - pixel(2), 8, "black", 6); - - // Draw cursor - guiControl.drawCursor(guiControl.trade.leftBorder - (guiControl.iconScaled), guiControl.trade.rowTop(guiControl.trade.cursorPosition + 2) - pixel(3)); + // Back Text + guiControl.drawPixelText("Back", guiControl.trade.leftBorder, guiControl.trade.rowTop(4) - pixel(2), 8, "black", 6); + + // Draw cursor + guiControl.drawCursor(guiControl.trade.leftBorder - (guiControl.iconScaled), guiControl.trade.rowTop(guiControl.trade.cursorPosition + 2) - pixel(3)); - // Button Action - if (guiControl.trade.activateDelay <= 0) { - if (ct_confirm().down) { - switch (guiControl.trade.cursorPosition) { - case 0: // Haggle - if (items.length > 0 && (guiControl.trade.island.timesHaggledToday <= G.stats.popularity) && // If there are items and you haven't haggled too much - guiControl.trade.island.haggleAmount == 0 && Math.floor(Math.randomRange(0, 100)) < G.stats.popularity) // Or you haven't haggled yet and get a random number less than your popularity, haggle successfully. - { - snd_sell.Play(); - guiControl.trade.island.haggleAmount = G.stats.haggling; - } else { - snd_cannotbuy.Play(); - guiControl.trade.island.timesHaggledToday++; - } + // Button Action + if (guiControl.trade.activateDelay <= 0) { + if (ct_confirm().down) { + switch (guiControl.trade.cursorPosition) { + case 0: { // Haggle + if (items.length > 0 && (guiControl.trade.island.timesHaggledToday <= G.stats.popularity) && // If there are items and you haven't haggled too much + guiControl.trade.island.haggleAmount == 0 && Math.floor(Math.randomRange(0, 100)) < G.stats.popularity) // Or you haven't haggled yet and get a random number less than your popularity, haggle successfully. + { + snd_sell.Play(); + guiControl.trade.island.haggleAmount = G.stats.haggling; + } else { + snd_cannotbuy.Play(); + guiControl.trade.island.timesHaggledToday++; + } break; - case 1: // Buy - if (items.length > 0 && - G.inventory.CanBuy(items[guiControl.trade.page], itemPrice) && - guiControl.trade.island.CanBuyFrom(items[guiControl.trade.page], itemPrice)) //If cursor is over yes and you can buy, buy it. - { - snd_buy.Play(); - guiControl.trade.island.BuyFrom(items[guiControl.trade.page], itemPrice); - } else { - snd_cannotbuy.Play(); - } + } + case 1: { // Buy + if (items.length > 0 && + G.inventory.CanBuy(items[guiControl.trade.page], itemPrice) && + guiControl.trade.island.CanBuyFrom(items[guiControl.trade.page], itemPrice)) //If cursor is over yes and you can buy, buy it. + { + snd_buy.Play(); + guiControl.trade.island.BuyFrom(items[guiControl.trade.page], itemPrice); + } else { + snd_cannotbuy.Play(); + } break; - default: - snd_cursorup.Play(); - guiControl.trade.screen = "main"; - guiControl.trade.activateDelay = 5; - guiControl.trade.cursorPosition = 0; // The position where "Buy" is on main screen. + } + default: { + snd_cursorup.Play(); + guiControl.trade.screen = "main"; + guiControl.trade.activateDelay = 5; + guiControl.trade.cursorPosition = 0; // The position where "Buy" is on main screen. break; - } - // console.log(guiControl.trade.screen); - } - if (ct_cancel().down) { - snd_cursorup.Play(); - guiControl.trade.screen = "main"; - guiControl.trade.activateDelay = 5; - guiControl.trade.cursorPosition = 0; // The position where "Buy" is on main screen. - // console.log(guiControl.trade.screen); - } - } - } - else if (guiControl.trade.screen == "sell") { - // console.log(guiControl.trade.screen); - // Limit Cursor - if (guiControl.trade.cursorPosition < 0) { - guiControl.trade.cursorPosition = 2; - } - if (guiControl.trade.cursorPosition > 2) { - guiControl.trade.cursorPosition = 0; - } + } + } + // console.log(guiControl.trade.screen); + } + if (ct_cancel().down) { + snd_cursorup.Play(); + guiControl.trade.screen = "main"; + guiControl.trade.activateDelay = 5; + guiControl.trade.cursorPosition = 0; // The position where "Buy" is on main screen. + // console.log(guiControl.trade.screen); + } + } + } + else if (guiControl.trade.screen == "sell") { + // console.log(guiControl.trade.screen); + // Limit Cursor + if (guiControl.trade.cursorPosition < 0) { + guiControl.trade.cursorPosition = 2; + } + if (guiControl.trade.cursorPosition > 2) { + guiControl.trade.cursorPosition = 0; + } - // Title - guiControl.drawPixelText("Sell", guiControl.trade.leftBorder - pixel(2), guiControl.topOfBackground, 10, "black", 6); + // Title + guiControl.drawPixelText("Sell", guiControl.trade.leftBorder - pixel(2), guiControl.topOfBackground, 10, "black", 6); - // Money icon - guiControl.drawIcon(7, 2, guiControl.trade.padding, guiControl.trade.rowTop(0) - pixel(3)); - guiControl.drawPixelText(G.inventory.moneyDisplay(), guiControl.trade.padding + pixel(guiControl.iconSize + 2), guiControl.trade.rowTop(0) + pixel(2) - pixel(3), 10, "black", 4); - - // Cargo icons - var items = G.inventory.CheckCargo(); // Contains the item ids that have more than 1 item + // Money icon + guiControl.drawIcon(7, 2, guiControl.trade.padding, guiControl.trade.rowTop(0) - pixel(3)); + guiControl.drawPixelText(G.inventory.moneyDisplay(), guiControl.trade.padding + pixel(guiControl.iconSize + 2), guiControl.trade.rowTop(0) + pixel(2) - pixel(3), 10, "black", 4); + + // Cargo icons + var items = G.inventory.CheckCargo(); // Contains the item ids that have more than 1 item - // Limit page - if (guiControl.trade.page < 0) { - guiControl.trade.page = items.length - 1; - } - if (guiControl.trade.page > items.length - 1) { - guiControl.trade.page = 0; - } + // Limit page + if (guiControl.trade.page < 0) { + guiControl.trade.page = items.length - 1; + } + if (guiControl.trade.page > items.length - 1) { + guiControl.trade.page = 0; + } - if (items.length > 0) { - var itemPrice = G.economy.cargoItemWorth[items[guiControl.trade.page]] + guiControl.trade.island.priceDifferences[items[guiControl.trade.page]]; - var priceCut = 0.5 + ((guiControl.trade.island.haggleAmount == 0) ? 0 : (G.stats.popularity * 0.01 * 0.5)); // If haggled successfully, lessen the price cut by half of your popularity's percent worth. - itemPrice = Math.round(itemPrice * priceCut); - if (itemPrice < 1) itemPrice = 1; - var itemPriceDisplay = itemPrice.toString() + " c"; - guiControl.drawItem(items[guiControl.trade.page], guiControl.trade.leftBorder, guiControl.trade.rowTop(1) - pixel(5)); - guiControl.drawPixelText(itemPriceDisplay, guiControl.trade.leftBorder + pixel(guiControl.iconSize + 4), guiControl.trade.rowTop(1) - pixel(5) + pixel(), 8, "black", 6); + if (items.length > 0) { + var itemPrice = G.economy.cargoItemWorth[items[guiControl.trade.page]] + guiControl.trade.island.priceDifferences[items[guiControl.trade.page]]; + var priceCut = 0.5 + ((guiControl.trade.island.haggleAmount == 0) ? 0 : (G.stats.popularity * 0.01 * 0.5)); // If haggled successfully, lessen the price cut by half of your popularity's percent worth. + itemPrice = Math.round(itemPrice * priceCut); + if (itemPrice < 1) itemPrice = 1; + var itemPriceDisplay = itemPrice.toString() + " c"; + guiControl.drawItem(items[guiControl.trade.page], guiControl.trade.leftBorder, guiControl.trade.rowTop(1) - pixel(5)); + guiControl.drawPixelText(itemPriceDisplay, guiControl.trade.leftBorder + pixel(guiControl.iconSize + 4), guiControl.trade.rowTop(1) - pixel(5) + pixel(), 8, "black", 6); - if (items.length > 1) { - guiControl.drawPageArrow("left", guiControl.trade.padding, guiControl.trade.rowTop(1) - pixel(5)); - guiControl.drawPageArrow("right", OS.camera.width - pixel(4) - guiControl.trade.padding, guiControl.trade.rowTop(1) - pixel(5)); - } + if (items.length > 1) { + guiControl.drawPageArrow("left", guiControl.trade.padding, guiControl.trade.rowTop(1) - pixel(5)); + guiControl.drawPageArrow("right", OS.camera.width - pixel(4) - guiControl.trade.padding, guiControl.trade.rowTop(1) - pixel(5)); + } - // Amounts - guiControl.drawPixelText("Shop" + guiControl.trade.island.inventory[items[guiControl.trade.page]].toString(), OS.camera.width - pixel(20), guiControl.trade.rowTop(2) - pixel(6) + pixel(), 4, (guiControl.trade.island.CanSellTo(items[guiControl.trade.page], itemPrice)) ? "black" : "yellow", 4); - guiControl.drawPixelText("Own " + G.inventory.cargo[items[guiControl.trade.page]].toString(), OS.camera.width - pixel(20), guiControl.trade.rowTop(3) - pixel(6) + pixel(), 4, (G.inventory.cargo[items[guiControl.trade.page]] > 0) ? "black" : "yellow", 4); - } else { - guiControl.drawPixelText("No Cargo!", guiControl.trade.padding, guiControl.trade.rowTop(1) - pixel(5) + pixel(), 10, "black", 6); - } + // Amounts + guiControl.drawPixelText("Shop" + guiControl.trade.island.inventory[items[guiControl.trade.page]].toString(), OS.camera.width - pixel(20), guiControl.trade.rowTop(2) - pixel(6) + pixel(), 4, (guiControl.trade.island.CanSellTo(items[guiControl.trade.page], itemPrice)) ? "black" : "yellow", 4); + guiControl.drawPixelText("Own " + G.inventory.cargo[items[guiControl.trade.page]].toString(), OS.camera.width - pixel(20), guiControl.trade.rowTop(3) - pixel(6) + pixel(), 4, (G.inventory.cargo[items[guiControl.trade.page]] > 0) ? "black" : "yellow", 4); + } else { + guiControl.drawPixelText("No Cargo!", guiControl.trade.padding, guiControl.trade.rowTop(1) - pixel(5) + pixel(), 10, "black", 6); + } - // Draw Amount of Cargo - guiControl.drawIcon(1, 1, OS.camera.width - pixel(20), guiControl.trade.rowTop(4) - pixel(5)); - guiControl.drawPixelText(G.inventory.CheckCargo().length.toString(), OS.camera.width - pixel(20) + (guiControl.iconScaled + pixel()), guiControl.trade.rowTop(4) - pixel(4), 4, (G.inventory.CheckCargo().length > 0) ? "black" : "yellow", 6); + // Draw Amount of Cargo + guiControl.drawIcon(1, 1, OS.camera.width - pixel(20), guiControl.trade.rowTop(4) - pixel(5)); + guiControl.drawPixelText(G.inventory.CheckCargo().length.toString(), OS.camera.width - pixel(20) + (guiControl.iconScaled + pixel()), guiControl.trade.rowTop(4) - pixel(4), 4, (G.inventory.CheckCargo().length > 0) ? "black" : "yellow", 6); - // Yes/No Options - guiControl.drawPixelText("Hagl?", guiControl.trade.leftBorder, guiControl.trade.rowTop(2) - pixel(2), 8, (guiControl.trade.island.timesHaggledToday >= G.stats.popularity) ? "yellow" : ((items.length > 0 && guiControl.trade.island.haggleAmount == 0) ? "black" : "white"), 6); - guiControl.drawPixelText((guiControl.trade.island.CanSellTo(items[guiControl.trade.page], itemPrice)) ? "Yes" : "Over!", guiControl.trade.leftBorder, guiControl.trade.rowTop(3) - pixel(2), 8, (items.length > 0 && G.inventory.CanSell(items[guiControl.trade.page])) ? ((guiControl.trade.island.CanSellTo(items[guiControl.trade.page], itemPrice)) ? "black" : "yellow") : "white", 6); + // Yes/No Options + guiControl.drawPixelText("Hagl?", guiControl.trade.leftBorder, guiControl.trade.rowTop(2) - pixel(2), 8, (guiControl.trade.island.timesHaggledToday >= G.stats.popularity) ? "yellow" : ((items.length > 0 && guiControl.trade.island.haggleAmount == 0) ? "black" : "white"), 6); + guiControl.drawPixelText((guiControl.trade.island.CanSellTo(items[guiControl.trade.page], itemPrice)) ? "Yes" : "Over!", guiControl.trade.leftBorder, guiControl.trade.rowTop(3) - pixel(2), 8, (items.length > 0 && G.inventory.CanSell(items[guiControl.trade.page])) ? ((guiControl.trade.island.CanSellTo(items[guiControl.trade.page], itemPrice)) ? "black" : "yellow") : "white", 6); - // Back Text - guiControl.drawPixelText("Back", guiControl.trade.leftBorder, guiControl.trade.rowTop(4) - pixel(2), 8, "black", 6); - - // Draw cursor - guiControl.drawCursor(guiControl.trade.leftBorder - (guiControl.iconScaled), guiControl.trade.rowTop(guiControl.trade.cursorPosition + 2) - pixel(3)); + // Back Text + guiControl.drawPixelText("Back", guiControl.trade.leftBorder, guiControl.trade.rowTop(4) - pixel(2), 8, "black", 6); + + // Draw cursor + guiControl.drawCursor(guiControl.trade.leftBorder - (guiControl.iconScaled), guiControl.trade.rowTop(guiControl.trade.cursorPosition + 2) - pixel(3)); - // Button Action - if (guiControl.trade.activateDelay <= 0) { - if (ct_confirm().down) { - switch (guiControl.trade.cursorPosition) { - case 0: // Haggle - if (items.length > 0 && (guiControl.trade.island.timesHaggledToday <= G.stats.popularity) && - guiControl.trade.island.haggleAmount == 0 && Math.floor(Math.randomRange(0, 100)) < G.stats.popularity) // If you haven't haggled yet and get a random number less than your popularity, haggle successfully. - { - snd_sell.Play(); - guiControl.trade.island.haggleAmount = G.stats.haggling; - } else { - snd_cannotbuy.Play(); - guiControl.trade.island.timesHaggledToday++; - } + // Button Action + if (guiControl.trade.activateDelay <= 0) { + if (ct_confirm().down) { + switch (guiControl.trade.cursorPosition) { + case 0: { // Haggle + if (items.length > 0 && (guiControl.trade.island.timesHaggledToday <= G.stats.popularity) && + guiControl.trade.island.haggleAmount == 0 && Math.floor(Math.randomRange(0, 100)) < G.stats.popularity) // If you haven't haggled yet and get a random number less than your popularity, haggle successfully. + { + snd_sell.Play(); + guiControl.trade.island.haggleAmount = G.stats.haggling; + } else { + snd_cannotbuy.Play(); + guiControl.trade.island.timesHaggledToday++; + } break; - case 1: // Sell - if (items.length > 0 && - G.inventory.CanSell(items[guiControl.trade.page]) && - guiControl.trade.island.CanSellTo(items[guiControl.trade.page], itemPrice)) //If cursor is over yes and you can buy, buy it. - { - snd_sell.Play(); - guiControl.trade.island.SellTo(items[guiControl.trade.page], itemPrice); - } else { - snd_cannotbuy.Play(); - } + } + case 1: { // Sell + if (items.length > 0 && + G.inventory.CanSell(items[guiControl.trade.page]) && + guiControl.trade.island.CanSellTo(items[guiControl.trade.page], itemPrice)) //If cursor is over yes and you can buy, buy it. + { + snd_sell.Play(); + guiControl.trade.island.SellTo(items[guiControl.trade.page], itemPrice); + } else { + snd_cannotbuy.Play(); + } break; - default: - snd_cursorup.Play(); - guiControl.trade.screen = "main"; - guiControl.trade.activateDelay = 5; - guiControl.trade.cursorPosition = 1; // The position where "Sell" is on main screen. + } + default: { + snd_cursorup.Play(); + guiControl.trade.screen = "main"; + guiControl.trade.activateDelay = 5; + guiControl.trade.cursorPosition = 1; // The position where "Sell" is on main screen. break; - } - // console.log(guiControl.trade.screen); - } - if (ct_cancel().down) { - snd_cursorup.Play(); - guiControl.trade.screen = "main"; - guiControl.trade.activateDelay = 5; - guiControl.trade.cursorPosition = 1; // The position where "Sell" is on main screen. - // console.log(guiControl.trade.screen); - } - } - } - else if (guiControl.trade.screen == "tavern") { - // Limit Cursor - if (guiControl.trade.cursorPosition < 0) { - guiControl.trade.cursorPosition = 2; - } - if (guiControl.trade.cursorPosition > 2) { - guiControl.trade.cursorPosition = 0; - } + } + } + // console.log(guiControl.trade.screen); + } + if (ct_cancel().down) { + snd_cursorup.Play(); + guiControl.trade.screen = "main"; + guiControl.trade.activateDelay = 5; + guiControl.trade.cursorPosition = 1; // The position where "Sell" is on main screen. + // console.log(guiControl.trade.screen); + } + } + } + else if (guiControl.trade.screen == "tavern") { + // Limit Cursor + if (guiControl.trade.cursorPosition < 0) { + guiControl.trade.cursorPosition = 2; + } + if (guiControl.trade.cursorPosition > 2) { + guiControl.trade.cursorPosition = 0; + } - // Title - guiControl.drawPixelText("Tavern", guiControl.leftBorder - pixel(6), guiControl.topOfBackground, 8, "black", 6); + // Title + guiControl.drawPixelText("Tavern", guiControl.leftBorder - pixel(6), guiControl.topOfBackground, 8, "black", 6); - var innPrice = G.economy.innCost + guiControl.trade.island.innPriceDifference; - guiControl.drawPixelText("Heal costs " + innPrice.toString() + " C", guiControl.leftBorder - pixel(5), guiControl.trade.rowTop(0) - pixel(), 10, "black", 4); + var innPrice = G.economy.innCost + guiControl.trade.island.innPriceDifference; + guiControl.drawPixelText("Heal costs " + innPrice.toString() + " C", guiControl.leftBorder - pixel(5), guiControl.trade.rowTop(0) - pixel(), 10, "black", 4); - // Money icon - guiControl.drawIcon(7, 2, guiControl.trade.padding, guiControl.trade.rowTop(1) - pixel()); - guiControl.drawPixelText(G.inventory.moneyDisplay(), guiControl.trade.padding + pixel(guiControl.iconSize + 2), guiControl.trade.rowTop(1) + pixel(), 10, "black", 4); - - // Options - guiControl.drawPixelText("Gossip", guiControl.leftBorder, guiControl.trade.rowTop(2) - pixel(), 0, "black", 6); - guiControl.drawPixelText("Heal", guiControl.leftBorder, guiControl.trade.rowTop(3) - pixel(), 4, (G.inventory.money > innPrice && G.stats.illness > 0) ? "black" : "white", 6); - // Illness icon - guiControl.drawIcon(4, 1, guiControl.leftBorder + pixel(30), guiControl.trade.rowTop(3) - pixel(2)); - guiControl.drawPixelText(G.stats.illness.toString(), guiControl.leftBorder + pixel(30) + pixel(guiControl.iconSize + 2), guiControl.trade.rowTop(3), 2, (G.stats.illness == 0) ? "yellow" : "black", 4); - - // Back Text - guiControl.drawPixelText("Back", guiControl.leftBorder, guiControl.trade.rowTop(4) - pixel(), 8, "black", 6); - - // Draw cursor - guiControl.drawCursor(guiControl.leftBorder - (guiControl.iconScaled), guiControl.trade.rowTop(guiControl.trade.cursorPosition + 2) - pixel(2)); + // Money icon + guiControl.drawIcon(7, 2, guiControl.trade.padding, guiControl.trade.rowTop(1) - pixel()); + guiControl.drawPixelText(G.inventory.moneyDisplay(), guiControl.trade.padding + pixel(guiControl.iconSize + 2), guiControl.trade.rowTop(1) + pixel(), 10, "black", 4); + + // Options + guiControl.drawPixelText("Gossip", guiControl.leftBorder, guiControl.trade.rowTop(2) - pixel(), 0, "black", 6); + guiControl.drawPixelText("Heal", guiControl.leftBorder, guiControl.trade.rowTop(3) - pixel(), 4, (G.inventory.money > innPrice && G.stats.illness > 0) ? "black" : "white", 6); + // Illness icon + guiControl.drawIcon(4, 1, guiControl.leftBorder + pixel(30), guiControl.trade.rowTop(3) - pixel(2)); + guiControl.drawPixelText(G.stats.illness.toString(), guiControl.leftBorder + pixel(30) + pixel(guiControl.iconSize + 2), guiControl.trade.rowTop(3), 2, (G.stats.illness == 0) ? "yellow" : "black", 4); + + // Back Text + guiControl.drawPixelText("Back", guiControl.leftBorder, guiControl.trade.rowTop(4) - pixel(), 8, "black", 6); + + // Draw cursor + guiControl.drawCursor(guiControl.leftBorder - (guiControl.iconScaled), guiControl.trade.rowTop(guiControl.trade.cursorPosition + 2) - pixel(2)); - // Button Action - if (guiControl.trade.activateDelay <= 0) { - if (ct_confirm().down) { - switch (guiControl.trade.cursorPosition) { - case 0: - snd_select.Play(); - guiControl.trade.screen = "gossip"; - guiControl.trade.activateDelay = 5; - guiControl.trade.cursorPosition = 2; // The position where "Supplies" is on main screen. + // Button Action + if (guiControl.trade.activateDelay <= 0) { + if (ct_confirm().down) { + switch (guiControl.trade.cursorPosition) { + case 0: { + snd_select.Play(); + guiControl.trade.screen = "gossip"; + guiControl.trade.activateDelay = 5; + guiControl.trade.cursorPosition = 2; // The position where "Supplies" is on main screen. break; - case 1: - if (G.stats.illness > 0 && G.inventory.money > innPrice) { //If cursor is over yes, heal illness with supplies. - snd_heal.Play(); - guiControl.trade.island.StayAtInn(); - } else { - snd_cannotbuy.Play(); - } + } + case 1: { + if (G.stats.illness > 0 && G.inventory.money > innPrice) { //If cursor is over yes, heal illness with supplies. + snd_heal.Play(); + guiControl.trade.island.StayAtInn(); + } else { + snd_cannotbuy.Play(); + } break; - default: - snd_cursorup.Play(); - guiControl.trade.screen = "main"; - guiControl.trade.activateDelay = 5; - guiControl.trade.cursorPosition = 2; // The position where "Supplies" is on main screen. + } + default: { + snd_cursorup.Play(); + guiControl.trade.screen = "main"; + guiControl.trade.activateDelay = 5; + guiControl.trade.cursorPosition = 2; // The position where "Supplies" is on main screen. break; - } + } + } - // Give a cooldown so you don't accidentally do something you don't want. - guiControl.trade.activateDelay = 5; - } + // Give a cooldown so you don't accidentally do something you don't want. + guiControl.trade.activateDelay = 5; + } - if (ct_cancel().down) { - snd_cursorup.Play(); - guiControl.trade.screen = "main"; - guiControl.trade.activateDelay = 5; - guiControl.trade.cursorPosition = 2; // The position where "Supplies" is on main screen. - } - } - } - else if (guiControl.trade.screen == "gossip") { - // console.log(guiControl.trade.screen); - // Limit Cursor - if (guiControl.trade.cursorPosition < 0) { - guiControl.trade.cursorPosition = 0; - } - if (guiControl.trade.cursorPosition > 0) { - guiControl.trade.cursorPosition = 0; - } + if (ct_cancel().down) { + snd_cursorup.Play(); + guiControl.trade.screen = "main"; + guiControl.trade.activateDelay = 5; + guiControl.trade.cursorPosition = 2; // The position where "Supplies" is on main screen. + } + } + } + else if (guiControl.trade.screen == "gossip") { + // console.log(guiControl.trade.screen); + // Limit Cursor + if (guiControl.trade.cursorPosition < 0) { + guiControl.trade.cursorPosition = 0; + } + if (guiControl.trade.cursorPosition > 0) { + guiControl.trade.cursorPosition = 0; + } - // Title - guiControl.drawPixelText("Gossip", guiControl.trade.padding, guiControl.topOfBackground, 10, "black", 6); + // Title + guiControl.drawPixelText("Gossip", guiControl.trade.padding, guiControl.topOfBackground, 10, "black", 6); - guiControl.drawPixelText("Use the map with M to find new islands to trade with!", guiControl.trade.padding, guiControl.trade.rowTop(0) - pixel(2), 0, "black", 4); - - // Back Text - guiControl.drawPixelText("Back", guiControl.trade.leftBorder, guiControl.trade.rowTop(4) - pixel(2), 8, "black", 6); - - // Draw cursor - guiControl.drawCursor(guiControl.trade.leftBorder - (guiControl.iconScaled), guiControl.trade.rowTop(4) - pixel(3)); + guiControl.drawPixelText("Use the map with M to find new islands to trade with!", guiControl.trade.padding, guiControl.trade.rowTop(0) - pixel(2), 0, "black", 4); + + // Back Text + guiControl.drawPixelText("Back", guiControl.trade.leftBorder, guiControl.trade.rowTop(4) - pixel(2), 8, "black", 6); + + // Draw cursor + guiControl.drawCursor(guiControl.trade.leftBorder - (guiControl.iconScaled), guiControl.trade.rowTop(4) - pixel(3)); - // Button Action - if (guiControl.trade.activateDelay <= 0) { - if (ct_confirm().down || ct_cancel().down) { - snd_cursorup.Play(); - guiControl.trade.screen = "tavern"; - guiControl.trade.activateDelay = 5; - guiControl.trade.cursorPosition = 0; - } - } - } - } + // Button Action + if (guiControl.trade.activateDelay <= 0) { + if (ct_confirm().down || ct_cancel().down) { + snd_cursorup.Play(); + guiControl.trade.screen = "tavern"; + guiControl.trade.activateDelay = 5; + guiControl.trade.cursorPosition = 0; + } + } + } + } } diff --git a/index.html b/index.html index f469b79..3872d0c 100644 --- a/index.html +++ b/index.html @@ -15,38 +15,41 @@
-An exploration and trade game built with OversimplifiedJS
+An exploration and trade game built with OversimplifiedJS
-This project is maintained by Alamantus GameDev
+This project is maintained by Alamantus GameDev
-You may need to refresh the page if all of the assets do not load.
- - -You may need to refresh the page if all of the assets do not load.
+ + +This page contains the in-dev version of the game, and the most recent stable version will be on Itch.io.
The game saves at the start of each day. If you stop in the middle of the day, you will lose your progress for that day.
There's no end game yet, but you can sail around and trade as long as you want. Try to make as much money as you can!
-