diff --git a/minified/gui/inventoryGUI.js b/minified/gui/inventoryGUI.js index 35bcb77..4615c3c 100644 --- a/minified/gui/inventoryGUI.js +++ b/minified/gui/inventoryGUI.js @@ -1 +1 @@ -function inventoryGUI(){Oversimplified.DEBUG.showMessages&&console.log("Ran inventoryGUI()")}function drawInventoryGUI(){if(guiControl.inventory&&guiControl.inventory.show)if(guiControl.inventory.activateDelay-=guiControl.inventory.activateDelay>0?1:0,OS.context.drawImage(guiControl.background,0,0,240,240,pixel(2),pixel(2),240,240),ct_down().down&&(snd_cursordown.Play(),guiControl.inventory.cursorPosition++),ct_up().down&&(snd_cursordown.Play(),guiControl.inventory.cursorPosition--),"main"==guiControl.inventory.screen){if(guiControl.inventory.cursorPosition<0&&(guiControl.inventory.cursorPosition=3),guiControl.inventory.cursorPosition>3&&(guiControl.inventory.cursorPosition=0),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.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),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),guiControl.drawPixelText("Status",guiControl.leftBorder,guiControl.rowTop(2)+pixel(),8,"black",6),guiControl.drawPixelText("Close",guiControl.leftBorder,guiControl.rowTop(3)+pixel(),8,"black",6),OS.context.drawImage(guiControl.cursor,guiControl.leftBorder-guiControl.iconScaled,guiControl.rowTop(guiControl.inventory.cursorPosition)),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";break;case 2:snd_select.Play(),guiControl.inventory.screen="status";break;default:snd_cursorup.Play(),guiControl.inventory.show=!1}guiControl.inventory.cursorPosition=0,guiControl.inventory.activateDelay=5}ct_cancel().down&&(snd_cursorup.Play(),guiControl.inventory.show=!1),ct_left().down&&(snd_cursordown.Play(),guiControl.inventory.show=!1,guiControl.map.activateDelay=5,guiControl.map.show=!0),ct_right().down&&(snd_cursordown.Play(),guiControl.inventory.show=!1,guiControl.map.activateDelay=5,guiControl.map.show=!0)}}else if("money"==guiControl.inventory.screen)guiControl.inventory.cursorPosition<0&&(guiControl.inventory.cursorPosition=0),guiControl.inventory.cursorPosition>0&&(guiControl.inventory.cursorPosition=0),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),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),guiControl.drawPixelText("Back",guiControl.leftBorder,guiControl.rowTop(4)-pixel(3),8,"black",6),OS.context.drawImage(guiControl.cursor,guiControl.leftBorder-guiControl.iconScaled,guiControl.rowTop(4)-pixel(4)),guiControl.inventory.activateDelay<=0&&(ct_confirm().down||ct_cancel().down)&&(snd_cursorup.Play(),guiControl.inventory.screen="main",guiControl.inventory.activateDelay=5,guiControl.inventory.cursorPosition=0);else if("cargo"==guiControl.inventory.screen){guiControl.inventory.cursorPosition<0&&(guiControl.inventory.cursorPosition=0),guiControl.inventory.cursorPosition>0&&(guiControl.inventory.cursorPosition=0),guiControl.drawPixelText("Cargo",guiControl.leftBorder+pixel(3),guiControl.topOfBackground,8,"black",6);for(var o=G.inventory.CheckCargo(),r=0;r0&&(guiControl.inventory.cursorPosition=0),guiControl.drawPixelText("Status",guiControl.leftBorder+pixel(),guiControl.topOfBackground,8,"black",6),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),guiControl.drawPixelText("Back",guiControl.leftBorder,guiControl.rowTop(4)-pixel(3),8,"black",6),guiControl.drawCursor(guiControl.leftBorder-guiControl.iconScaled,guiControl.rowTop(4)-pixel(3)),guiControl.inventory.activateDelay<=0&&(ct_confirm().down||ct_cancel().down)&&(snd_cursorup.Play(),guiControl.inventory.screen="main",guiControl.inventory.activateDelay=5,guiControl.inventory.cursorPosition=2))}guiControl.inventory={screen:"main",cursorPosition:0,show:!1,activateDelay:0}; \ No newline at end of file +function inventoryGUI(){guiControl.inventory={screen:"main",cursorPosition:0,show:!1,activateDelay:0}}function drawInventoryGUI(){if(guiControl.inventory&&guiControl.inventory.show)if(guiControl.inventory.activateDelay-=guiControl.inventory.activateDelay>0?1:0,OS.context.drawImage(guiControl.background,0,0,240,240,pixel(2),pixel(2),240,240),ct_down().down&&(snd_cursordown.Play(),guiControl.inventory.cursorPosition++),ct_up().down&&(snd_cursordown.Play(),guiControl.inventory.cursorPosition--),"main"==guiControl.inventory.screen){if(guiControl.inventory.cursorPosition<0&&(guiControl.inventory.cursorPosition=3),guiControl.inventory.cursorPosition>3&&(guiControl.inventory.cursorPosition=0),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.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),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),guiControl.drawPixelText("Status",guiControl.leftBorder,guiControl.rowTop(2)+pixel(),8,"black",6),guiControl.drawPixelText("Close",guiControl.leftBorder,guiControl.rowTop(3)+pixel(),8,"black",6),OS.context.drawImage(guiControl.cursor,guiControl.leftBorder-guiControl.iconScaled,guiControl.rowTop(guiControl.inventory.cursorPosition)),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";break;case 2:snd_select.Play(),guiControl.inventory.screen="status";break;default:snd_cursorup.Play(),guiControl.inventory.show=!1}guiControl.inventory.cursorPosition=0,guiControl.inventory.activateDelay=5}ct_cancel().down&&(snd_cursorup.Play(),guiControl.inventory.show=!1),ct_left().down&&(snd_cursordown.Play(),guiControl.inventory.show=!1,guiControl.map.activateDelay=5,guiControl.map.show=!0),ct_right().down&&(snd_cursordown.Play(),guiControl.inventory.show=!1,guiControl.map.activateDelay=5,guiControl.map.show=!0)}}else if("money"==guiControl.inventory.screen)guiControl.inventory.cursorPosition<0&&(guiControl.inventory.cursorPosition=0),guiControl.inventory.cursorPosition>0&&(guiControl.inventory.cursorPosition=0),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),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),guiControl.drawPixelText("Back",guiControl.leftBorder,guiControl.rowTop(4)-pixel(3),8,"black",6),OS.context.drawImage(guiControl.cursor,guiControl.leftBorder-guiControl.iconScaled,guiControl.rowTop(4)-pixel(4)),guiControl.inventory.activateDelay<=0&&(ct_confirm().down||ct_cancel().down)&&(snd_cursorup.Play(),guiControl.inventory.screen="main",guiControl.inventory.activateDelay=5,guiControl.inventory.cursorPosition=0);else if("cargo"==guiControl.inventory.screen){guiControl.inventory.cursorPosition<0&&(guiControl.inventory.cursorPosition=0),guiControl.inventory.cursorPosition>0&&(guiControl.inventory.cursorPosition=0),guiControl.drawPixelText("Cargo",guiControl.leftBorder+pixel(3),guiControl.topOfBackground,8,"black",6);for(var o=G.inventory.CheckCargo(),r=0;r0&&(guiControl.inventory.cursorPosition=0),guiControl.drawPixelText("Status",guiControl.leftBorder+pixel(),guiControl.topOfBackground,8,"black",6),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),guiControl.drawPixelText("Back",guiControl.leftBorder,guiControl.rowTop(4)-pixel(3),8,"black",6),guiControl.drawCursor(guiControl.leftBorder-guiControl.iconScaled,guiControl.rowTop(4)-pixel(3)),guiControl.inventory.activateDelay<=0&&(ct_confirm().down||ct_cancel().down)&&(snd_cursorup.Play(),guiControl.inventory.screen="main",guiControl.inventory.activateDelay=5,guiControl.inventory.cursorPosition=2))} \ No newline at end of file diff --git a/minified/gui/mapGUI.js b/minified/gui/mapGUI.js index 98a1ddd..326e244 100644 --- a/minified/gui/mapGUI.js +++ b/minified/gui/mapGUI.js @@ -1 +1 @@ -function mapGUI(){Oversimplified.DEBUG.showMessages&&console.log("Ran mapGUI()")}function drawMapGUI(){if(guiControl.map&&guiControl.map.show){guiControl.map.activateDelay-=guiControl.map.activateDelay>0?1:0,OS.context.drawImage(guiControl.background,0,0,240,240,pixel(2),pixel(2),240,240),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);var o=OS.context.fillStyle,t=guiControl.leftBorder-pixel(5),l=guiControl.upperBorder;OS.context.fillStyle="#0000CC",OS.context.fillRect(t,l,pixel(50),pixel(45)),OS.context.fillStyle="#00FF00";for(var e=0;e0?1:0,OS.context.drawImage(guiControl.background,0,0,240,240,pixel(2),pixel(2),240,240),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);var o=OS.context.fillStyle,t=guiControl.leftBorder-pixel(5),l=guiControl.upperBorder;OS.context.fillStyle="#0000CC",OS.context.fillRect(t,l,pixel(50),pixel(45)),OS.context.fillStyle="#00FF00";for(var e=0;e0?1:0,"main"==guiControl.title.screen){if(ct_down().down&&(snd_cursordown.Play(),guiControl.title.cursorPosition++),ct_up().down&&(snd_cursordown.Play(),guiControl.title.cursorPosition--),guiControl.title.cursorPosition<0&&(guiControl.title.cursorPosition=2),guiControl.title.cursorPosition>2&&(guiControl.title.cursorPosition=0),OS.context.drawImage(guiControl.titleImage,0,0),guiControl.drawPixelText("New Game",guiControl.title.leftBorder,guiControl.title.rowTop(0),10,"white",6),guiControl.drawPixelText("Continue",guiControl.title.leftBorder,guiControl.title.rowTop(1),10,G.savedGameExists?"white":"black",6),guiControl.drawPixelText("Options",guiControl.title.leftBorder,guiControl.title.rowTop(2)+pixel(),8,guiControl.optionsScreen?"white":"black",6),OS.context.drawImage(guiControl.cursor,guiControl.title.leftBorder-guiControl.iconScaled,guiControl.title.rowTop(guiControl.title.cursorPosition)),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=!1,G.gameStarted=!0,G.SaveGame();break;case 1:G.savedGameExists?(G.LoadGame(),snd_select.Play(),mus_title.Stop(),mus_sail.Play(),guiControl.title.show=!1,G.gameStarted=!0):snd_cannotbuy.Play();break;case 2:snd_cannotbuy.Play()}guiControl.title.cursorPosition=0}ct_cancel().down&&(guiControl.title.screen="credits")}}else"credits"==guiControl.title.screen&&(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),(ct_confirm().down||ct_cancel().down||ct_esc.down)&&(guiControl.title.screen="main"))}guiControl.title={screen:"main",show:!0,cursorPosition:0,activateDelay:0,padding:pixel(2),leftBorder:pixel(12),rowTop:function(t){return pixel(32)+pixel(2)+pixel((guiControl.iconSize+2)*t)}}; \ No newline at end of file +function titleScreen(){guiControl.title={screen:"main",show:!0,cursorPosition:0,activateDelay:0,padding:pixel(2),leftBorder:pixel(12),rowTop:function(t){return pixel(32)+pixel(2)+pixel((guiControl.iconSize+2)*t)}}}function drawTitleScreen(){if(guiControl.title&&guiControl.title.show)if(guiControl.title.activateDelay-=guiControl.title.activateDelay>0?1:0,"main"==guiControl.title.screen){if(ct_down().down&&(snd_cursordown.Play(),guiControl.title.cursorPosition++),ct_up().down&&(snd_cursordown.Play(),guiControl.title.cursorPosition--),guiControl.title.cursorPosition<0&&(guiControl.title.cursorPosition=2),guiControl.title.cursorPosition>2&&(guiControl.title.cursorPosition=0),OS.context.drawImage(guiControl.titleImage,0,0),guiControl.drawPixelText("New Game",guiControl.title.leftBorder,guiControl.title.rowTop(0),10,"white",6),guiControl.drawPixelText("Continue",guiControl.title.leftBorder,guiControl.title.rowTop(1),10,G.savedGameExists?"white":"black",6),guiControl.drawPixelText("Options",guiControl.title.leftBorder,guiControl.title.rowTop(2)+pixel(),8,guiControl.optionsScreen?"white":"black",6),OS.context.drawImage(guiControl.cursor,guiControl.title.leftBorder-guiControl.iconScaled,guiControl.title.rowTop(guiControl.title.cursorPosition)),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=!1,G.gameStarted=!0,G.SaveGame();break;case 1:G.savedGameExists?(G.LoadGame(),snd_select.Play(),mus_title.Stop(),mus_sail.Play(),guiControl.title.show=!1,G.gameStarted=!0):snd_cannotbuy.Play();break;case 2:snd_cannotbuy.Play()}guiControl.title.cursorPosition=0}ct_cancel().down&&(guiControl.title.screen="credits")}}else"credits"==guiControl.title.screen&&(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),(ct_confirm().down||ct_cancel().down||ct_esc.down)&&(guiControl.title.screen="main"))} \ No newline at end of file diff --git a/minified/gui/tradeGUI.js b/minified/gui/tradeGUI.js index 1095904..685a0c7 100644 --- a/minified/gui/tradeGUI.js +++ b/minified/gui/tradeGUI.js @@ -1 +1 @@ -function tradeGUI(){Oversimplified.DEBUG.showMessages&&console.log("Ran tradeGUI()")}function drawTradeGUI(){if(guiControl.trade&&guiControl.trade.show){guiControl.trade.activateDelay-=guiControl.trade.activateDelay>0?1:0;var o=Oversimplified.context.fillStyle;if(Oversimplified.context.fillStyle="#D9BEA5",Oversimplified.context.fillRect(0,0,Oversimplified.camera.width,Oversimplified.camera.height),Oversimplified.context.fillStyle=o,ct_down().down&&(snd_cursordown.Play(),guiControl.trade.cursorPosition++),ct_up().down&&(snd_cursordown.Play(),guiControl.trade.cursorPosition--),ct_right().down&&(snd_cursordown.Play(),guiControl.trade.page++),ct_left().down&&(snd_cursordown.Play(),guiControl.trade.page--),"main"==guiControl.trade.screen){if(guiControl.trade.cursorPosition<0&&(guiControl.trade.cursorPosition=3),guiControl.trade.cursorPosition>3&&(guiControl.trade.cursorPosition=0),guiControl.trade.page<0&&(guiControl.trade.page=0),guiControl.trade.page>0&&(guiControl.trade.page=0),guiControl.drawPixelText("On Island",2*guiControl.trade.padding,guiControl.trade.padding,10,"black",6),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),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),guiControl.drawPixelText("Tavern",guiControl.trade.leftBorder,guiControl.trade.rowTop(2)+pixel(),8,"black",6),guiControl.drawPixelText("Leave",guiControl.trade.leftBorder,guiControl.trade.rowTop(3)+pixel(),8,"black",6),OS.context.drawImage(guiControl.cursor,guiControl.trade.leftBorder-guiControl.iconScaled,guiControl.trade.rowTop(guiControl.trade.cursorPosition)),guiControl.trade.activateDelay<=0){if(ct_confirm().down){switch(guiControl.trade.cursorPosition){case 0:guiControl.trade.island.CheckInventory().length>0?(snd_select.Play(),guiControl.trade.screen="buy",guiControl.trade.activateDelay=5):snd_cannotbuy.Play();break;case 1:G.inventory.CheckCargo().length>0?(snd_select.Play(),guiControl.trade.screen="sell",guiControl.trade.activateDelay=5):snd_cannotbuy.Play();break;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=!1}guiControl.trade.cursorPosition=0,guiControl.trade.page=0}ct_cancel().down&&(snd_cursorup.Play(),mus_trade.Stop(),mus_sail.Play(),guiControl.trade.show=!1)}}else if("buy"==guiControl.trade.screen){guiControl.trade.cursorPosition<0&&(guiControl.trade.cursorPosition=2),guiControl.trade.cursorPosition>2&&(guiControl.trade.cursorPosition=0),guiControl.drawPixelText("Buy",guiControl.trade.leftBorder-pixel(2),guiControl.topOfBackground,10,"black",6),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);var r=guiControl.trade.island.CheckInventory();if(guiControl.trade.page<0&&(guiControl.trade.page=r.length-1),guiControl.trade.page>r.length-1&&(guiControl.trade.page=0),r.length>0){var t=G.economy.cargoItemWorth[r[guiControl.trade.page]]+guiControl.trade.island.priceDifferences[r[guiControl.trade.page]]-guiControl.trade.island.haggleAmount;1>t&&(t=1);var e=t.toString()+" c";guiControl.drawItem(r[guiControl.trade.page],guiControl.trade.leftBorder,guiControl.trade.rowTop(1)-pixel(5)),guiControl.drawPixelText(e,guiControl.trade.leftBorder+pixel(guiControl.iconSize+4),guiControl.trade.rowTop(1)-pixel(5)+pixel(),8,"black",6),r.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))),guiControl.drawPixelText("Shop"+guiControl.trade.island.inventory[r[guiControl.trade.page]].toString(),OS.camera.width-pixel(20),guiControl.trade.rowTop(2)-pixel(6)+pixel(),4,"black",4),guiControl.drawPixelText("Own "+G.inventory.cargo[r[guiControl.trade.page]].toString(),OS.camera.width-pixel(20),guiControl.trade.rowTop(3)-pixel(6)+pixel(),4,G.inventory.cargo[r[guiControl.trade.page]]=G.stats.popularity?"yellow":r.length>0&&0==guiControl.trade.island.haggleAmount?"black":"white",6),guiControl.drawPixelText("Yes",guiControl.trade.leftBorder,guiControl.trade.rowTop(3)-pixel(2),8,r.length>0&&G.inventory.CanBuy(r[guiControl.trade.page],t)?"black":"white",6),guiControl.drawPixelText("Back",guiControl.trade.leftBorder,guiControl.trade.rowTop(4)-pixel(2),8,"black",6),OS.context.drawImage(guiControl.cursor,guiControl.trade.leftBorder-guiControl.iconScaled,guiControl.trade.rowTop(guiControl.trade.cursorPosition+2)-pixel(3)),guiControl.trade.activateDelay<=0){if(ct_confirm().down)switch(guiControl.trade.cursorPosition){case 0:r.length>0&&guiControl.trade.island.timesHaggledToday<=G.stats.popularity&&0==guiControl.trade.island.haggleAmount&&Math.floor(Math.randomRange(0,100))0&&G.inventory.CanBuy(r[guiControl.trade.page],t)?(snd_buy.Play(),guiControl.trade.island.BuyFrom(r[guiControl.trade.page],t)):snd_cannotbuy.Play();break;default:snd_cursorup.Play(),guiControl.trade.screen="main",guiControl.trade.activateDelay=5,guiControl.trade.cursorPosition=0}ct_cancel().down&&(snd_cursorup.Play(),guiControl.trade.screen="main",guiControl.trade.activateDelay=5,guiControl.trade.cursorPosition=0)}}else if("sell"==guiControl.trade.screen){guiControl.trade.cursorPosition<0&&(guiControl.trade.cursorPosition=2),guiControl.trade.cursorPosition>2&&(guiControl.trade.cursorPosition=0),guiControl.drawPixelText("Sell",guiControl.trade.leftBorder-pixel(2),guiControl.topOfBackground,10,"black",6),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);var r=G.inventory.CheckCargo();if(guiControl.trade.page<0&&(guiControl.trade.page=r.length-1),guiControl.trade.page>r.length-1&&(guiControl.trade.page=0),r.length>0){var t=G.economy.cargoItemWorth[r[guiControl.trade.page]]+guiControl.trade.island.priceDifferences[r[guiControl.trade.page]],i=.5+(0==guiControl.trade.island.haggleAmount?0:.01*G.stats.popularity*.5);t=Math.round(t*i),1>t&&(t=1);var e=t.toString()+" c";guiControl.drawItem(r[guiControl.trade.page],guiControl.trade.leftBorder,guiControl.trade.rowTop(1)-pixel(5)),guiControl.drawPixelText(e,guiControl.trade.leftBorder+pixel(guiControl.iconSize+4),guiControl.trade.rowTop(1)-pixel(5)+pixel(),8,"black",6),r.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))),guiControl.drawPixelText("Shop"+guiControl.trade.island.inventory[r[guiControl.trade.page]].toString(),OS.camera.width-pixel(20),guiControl.trade.rowTop(2)-pixel(6)+pixel(),4,"black",4),guiControl.drawPixelText("Own "+G.inventory.cargo[r[guiControl.trade.page]].toString(),OS.camera.width-pixel(20),guiControl.trade.rowTop(3)-pixel(6)+pixel(),4,G.inventory.cargo[r[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);if(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),guiControl.drawPixelText("Hagl?",guiControl.trade.leftBorder,guiControl.trade.rowTop(2)-pixel(2),8,guiControl.trade.island.timesHaggledToday>=G.stats.popularity?"yellow":r.length>0&&0==guiControl.trade.island.haggleAmount?"black":"white",6),guiControl.drawPixelText("Yes",guiControl.trade.leftBorder,guiControl.trade.rowTop(3)-pixel(2),8,r.length>0&&G.inventory.CanSell(r[guiControl.trade.page])?"black":"white",6),guiControl.drawPixelText("Back",guiControl.trade.leftBorder,guiControl.trade.rowTop(4)-pixel(2),8,"black",6),OS.context.drawImage(guiControl.cursor,guiControl.trade.leftBorder-guiControl.iconScaled,guiControl.trade.rowTop(guiControl.trade.cursorPosition+2)-pixel(3)),guiControl.trade.activateDelay<=0){if(ct_confirm().down)switch(guiControl.trade.cursorPosition){case 0:r.length>0&&guiControl.trade.island.timesHaggledToday<=G.stats.popularity&&0==guiControl.trade.island.haggleAmount&&Math.floor(Math.randomRange(0,100))0&&G.inventory.CanSell(r[guiControl.trade.page])?(snd_sell.Play(),guiControl.trade.island.SellTo(r[guiControl.trade.page],t)):snd_cannotbuy.Play();break;default:snd_cursorup.Play(),guiControl.trade.screen="main",guiControl.trade.activateDelay=5,guiControl.trade.cursorPosition=1}ct_cancel().down&&(snd_cursorup.Play(),guiControl.trade.screen="main",guiControl.trade.activateDelay=5,guiControl.trade.cursorPosition=1)}}else if("tavern"==guiControl.trade.screen){guiControl.trade.cursorPosition<0&&(guiControl.trade.cursorPosition=2),guiControl.trade.cursorPosition>2&&(guiControl.trade.cursorPosition=0),guiControl.drawPixelText("Tavern",guiControl.leftBorder-pixel(6),guiControl.topOfBackground,8,"black",6);var l=G.economy.innCost+guiControl.trade.island.innPriceDifference;if(guiControl.drawPixelText("Heal costs "+l.toString()+" C",guiControl.leftBorder-pixel(5),guiControl.trade.rowTop(0)-pixel(),10,"black",4),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),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>l&&G.stats.illness>0?"black":"white",6),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,0==G.stats.illness?"yellow":"black",4),guiControl.drawPixelText("Back",guiControl.leftBorder,guiControl.trade.rowTop(4)-pixel(),8,"black",6),guiControl.drawCursor(guiControl.leftBorder-guiControl.iconScaled,guiControl.trade.rowTop(guiControl.trade.cursorPosition+2)-pixel(2)),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;break;case 1:G.stats.illness>0&&G.inventory.money>l?(snd_heal.Play(),guiControl.trade.island.StayAtInn()):snd_cannotbuy.Play();break;default:snd_cursorup.Play(),guiControl.trade.screen="main",guiControl.trade.activateDelay=5,guiControl.trade.cursorPosition=2}guiControl.trade.activateDelay=5}ct_cancel().down&&(snd_cursorup.Play(),guiControl.trade.screen="main",guiControl.trade.activateDelay=5,guiControl.trade.cursorPosition=2)}}else"gossip"==guiControl.trade.screen&&(guiControl.trade.cursorPosition<0&&(guiControl.trade.cursorPosition=0),guiControl.trade.cursorPosition>0&&(guiControl.trade.cursorPosition=0),guiControl.drawPixelText("Gossip",guiControl.trade.padding,guiControl.topOfBackground,10,"black",6),guiControl.drawPixelText("Nothing interesting to report! / / / / / -Actually, this isnt in the game yet-",guiControl.trade.padding,guiControl.trade.rowTop(0)-pixel(2),0,"black",4),guiControl.drawPixelText("Back",guiControl.trade.leftBorder,guiControl.trade.rowTop(4)-pixel(2),8,"black",6),OS.context.drawImage(guiControl.cursor,guiControl.trade.leftBorder-guiControl.iconScaled,guiControl.trade.rowTop(4)-pixel(3)),guiControl.trade.activateDelay<=0&&(ct_confirm().down||ct_cancel().down)&&(snd_cursorup.Play(),guiControl.trade.screen="tavern",guiControl.trade.activateDelay=5,guiControl.trade.cursorPosition=0))}}guiControl.trade={screen:"main",cursorPosition:0,page:0,itemsPerPage:3,show:!1,activateDelay:0,island:null,padding:pixel(2),leftBorder:pixel(12),rowTop:function(o){return guiControl.trade.padding+pixel(6)+3*guiControl.trade.padding+pixel((guiControl.iconSize+3)*o)}}; \ No newline at end of file +function tradeGUI(){guiControl.trade={screen:"main",cursorPosition:0,page:0,itemsPerPage:3,show:!1,activateDelay:0,island:null,padding:pixel(2),leftBorder:pixel(12),rowTop:function(o){return guiControl.trade.padding+pixel(6)+3*guiControl.trade.padding+pixel((guiControl.iconSize+3)*o)}}}function drawTradeGUI(){if(guiControl.trade&&guiControl.trade.show){guiControl.trade.activateDelay-=guiControl.trade.activateDelay>0?1:0;var o=Oversimplified.context.fillStyle;if(Oversimplified.context.fillStyle="#D9BEA5",Oversimplified.context.fillRect(0,0,Oversimplified.camera.width,Oversimplified.camera.height),Oversimplified.context.fillStyle=o,ct_down().down&&(snd_cursordown.Play(),guiControl.trade.cursorPosition++),ct_up().down&&(snd_cursordown.Play(),guiControl.trade.cursorPosition--),ct_right().down&&(snd_cursordown.Play(),guiControl.trade.page++),ct_left().down&&(snd_cursordown.Play(),guiControl.trade.page--),"main"==guiControl.trade.screen){if(guiControl.trade.cursorPosition<0&&(guiControl.trade.cursorPosition=3),guiControl.trade.cursorPosition>3&&(guiControl.trade.cursorPosition=0),guiControl.trade.page<0&&(guiControl.trade.page=0),guiControl.trade.page>0&&(guiControl.trade.page=0),guiControl.drawPixelText("On Island",2*guiControl.trade.padding,guiControl.trade.padding,10,"black",6),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),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),guiControl.drawPixelText("Tavern",guiControl.trade.leftBorder,guiControl.trade.rowTop(2)+pixel(),8,"black",6),guiControl.drawPixelText("Leave",guiControl.trade.leftBorder,guiControl.trade.rowTop(3)+pixel(),8,"black",6),OS.context.drawImage(guiControl.cursor,guiControl.trade.leftBorder-guiControl.iconScaled,guiControl.trade.rowTop(guiControl.trade.cursorPosition)),guiControl.trade.activateDelay<=0){if(ct_confirm().down){switch(guiControl.trade.cursorPosition){case 0:guiControl.trade.island.CheckInventory().length>0?(snd_select.Play(),guiControl.trade.screen="buy",guiControl.trade.activateDelay=5):snd_cannotbuy.Play();break;case 1:G.inventory.CheckCargo().length>0?(snd_select.Play(),guiControl.trade.screen="sell",guiControl.trade.activateDelay=5):snd_cannotbuy.Play();break;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=!1}guiControl.trade.cursorPosition=0,guiControl.trade.page=0}ct_cancel().down&&(snd_cursorup.Play(),mus_trade.Stop(),mus_sail.Play(),guiControl.trade.show=!1)}}else if("buy"==guiControl.trade.screen){guiControl.trade.cursorPosition<0&&(guiControl.trade.cursorPosition=2),guiControl.trade.cursorPosition>2&&(guiControl.trade.cursorPosition=0),guiControl.drawPixelText("Buy",guiControl.trade.leftBorder-pixel(2),guiControl.topOfBackground,10,"black",6),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);var r=guiControl.trade.island.CheckInventory();if(guiControl.trade.page<0&&(guiControl.trade.page=r.length-1),guiControl.trade.page>r.length-1&&(guiControl.trade.page=0),r.length>0){var t=G.economy.cargoItemWorth[r[guiControl.trade.page]]+guiControl.trade.island.priceDifferences[r[guiControl.trade.page]]-guiControl.trade.island.haggleAmount;1>t&&(t=1);var e=t.toString()+" c";guiControl.drawItem(r[guiControl.trade.page],guiControl.trade.leftBorder,guiControl.trade.rowTop(1)-pixel(5)),guiControl.drawPixelText(e,guiControl.trade.leftBorder+pixel(guiControl.iconSize+4),guiControl.trade.rowTop(1)-pixel(5)+pixel(),8,"black",6),r.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))),guiControl.drawPixelText("Shop"+guiControl.trade.island.inventory[r[guiControl.trade.page]].toString(),OS.camera.width-pixel(20),guiControl.trade.rowTop(2)-pixel(6)+pixel(),4,"black",4),guiControl.drawPixelText("Own "+G.inventory.cargo[r[guiControl.trade.page]].toString(),OS.camera.width-pixel(20),guiControl.trade.rowTop(3)-pixel(6)+pixel(),4,G.inventory.cargo[r[guiControl.trade.page]]=G.stats.popularity?"yellow":r.length>0&&0==guiControl.trade.island.haggleAmount?"black":"white",6),guiControl.drawPixelText("Yes",guiControl.trade.leftBorder,guiControl.trade.rowTop(3)-pixel(2),8,r.length>0&&G.inventory.CanBuy(r[guiControl.trade.page],t)?"black":"white",6),guiControl.drawPixelText("Back",guiControl.trade.leftBorder,guiControl.trade.rowTop(4)-pixel(2),8,"black",6),OS.context.drawImage(guiControl.cursor,guiControl.trade.leftBorder-guiControl.iconScaled,guiControl.trade.rowTop(guiControl.trade.cursorPosition+2)-pixel(3)),guiControl.trade.activateDelay<=0){if(ct_confirm().down)switch(guiControl.trade.cursorPosition){case 0:r.length>0&&guiControl.trade.island.timesHaggledToday<=G.stats.popularity&&0==guiControl.trade.island.haggleAmount&&Math.floor(Math.randomRange(0,100))0&&G.inventory.CanBuy(r[guiControl.trade.page],t)?(snd_buy.Play(),guiControl.trade.island.BuyFrom(r[guiControl.trade.page],t)):snd_cannotbuy.Play();break;default:snd_cursorup.Play(),guiControl.trade.screen="main",guiControl.trade.activateDelay=5,guiControl.trade.cursorPosition=0}ct_cancel().down&&(snd_cursorup.Play(),guiControl.trade.screen="main",guiControl.trade.activateDelay=5,guiControl.trade.cursorPosition=0)}}else if("sell"==guiControl.trade.screen){guiControl.trade.cursorPosition<0&&(guiControl.trade.cursorPosition=2),guiControl.trade.cursorPosition>2&&(guiControl.trade.cursorPosition=0),guiControl.drawPixelText("Sell",guiControl.trade.leftBorder-pixel(2),guiControl.topOfBackground,10,"black",6),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);var r=G.inventory.CheckCargo();if(guiControl.trade.page<0&&(guiControl.trade.page=r.length-1),guiControl.trade.page>r.length-1&&(guiControl.trade.page=0),r.length>0){var t=G.economy.cargoItemWorth[r[guiControl.trade.page]]+guiControl.trade.island.priceDifferences[r[guiControl.trade.page]],i=.5+(0==guiControl.trade.island.haggleAmount?0:.01*G.stats.popularity*.5);t=Math.round(t*i),1>t&&(t=1);var e=t.toString()+" c";guiControl.drawItem(r[guiControl.trade.page],guiControl.trade.leftBorder,guiControl.trade.rowTop(1)-pixel(5)),guiControl.drawPixelText(e,guiControl.trade.leftBorder+pixel(guiControl.iconSize+4),guiControl.trade.rowTop(1)-pixel(5)+pixel(),8,"black",6),r.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))),guiControl.drawPixelText("Shop"+guiControl.trade.island.inventory[r[guiControl.trade.page]].toString(),OS.camera.width-pixel(20),guiControl.trade.rowTop(2)-pixel(6)+pixel(),4,"black",4),guiControl.drawPixelText("Own "+G.inventory.cargo[r[guiControl.trade.page]].toString(),OS.camera.width-pixel(20),guiControl.trade.rowTop(3)-pixel(6)+pixel(),4,G.inventory.cargo[r[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);if(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),guiControl.drawPixelText("Hagl?",guiControl.trade.leftBorder,guiControl.trade.rowTop(2)-pixel(2),8,guiControl.trade.island.timesHaggledToday>=G.stats.popularity?"yellow":r.length>0&&0==guiControl.trade.island.haggleAmount?"black":"white",6),guiControl.drawPixelText("Yes",guiControl.trade.leftBorder,guiControl.trade.rowTop(3)-pixel(2),8,r.length>0&&G.inventory.CanSell(r[guiControl.trade.page])?"black":"white",6),guiControl.drawPixelText("Back",guiControl.trade.leftBorder,guiControl.trade.rowTop(4)-pixel(2),8,"black",6),OS.context.drawImage(guiControl.cursor,guiControl.trade.leftBorder-guiControl.iconScaled,guiControl.trade.rowTop(guiControl.trade.cursorPosition+2)-pixel(3)),guiControl.trade.activateDelay<=0){if(ct_confirm().down)switch(guiControl.trade.cursorPosition){case 0:r.length>0&&guiControl.trade.island.timesHaggledToday<=G.stats.popularity&&0==guiControl.trade.island.haggleAmount&&Math.floor(Math.randomRange(0,100))0&&G.inventory.CanSell(r[guiControl.trade.page])?(snd_sell.Play(),guiControl.trade.island.SellTo(r[guiControl.trade.page],t)):snd_cannotbuy.Play();break;default:snd_cursorup.Play(),guiControl.trade.screen="main",guiControl.trade.activateDelay=5,guiControl.trade.cursorPosition=1}ct_cancel().down&&(snd_cursorup.Play(),guiControl.trade.screen="main",guiControl.trade.activateDelay=5,guiControl.trade.cursorPosition=1)}}else if("tavern"==guiControl.trade.screen){guiControl.trade.cursorPosition<0&&(guiControl.trade.cursorPosition=2),guiControl.trade.cursorPosition>2&&(guiControl.trade.cursorPosition=0),guiControl.drawPixelText("Tavern",guiControl.leftBorder-pixel(6),guiControl.topOfBackground,8,"black",6);var l=G.economy.innCost+guiControl.trade.island.innPriceDifference;if(guiControl.drawPixelText("Heal costs "+l.toString()+" C",guiControl.leftBorder-pixel(5),guiControl.trade.rowTop(0)-pixel(),10,"black",4),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),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>l&&G.stats.illness>0?"black":"white",6),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,0==G.stats.illness?"yellow":"black",4),guiControl.drawPixelText("Back",guiControl.leftBorder,guiControl.trade.rowTop(4)-pixel(),8,"black",6),guiControl.drawCursor(guiControl.leftBorder-guiControl.iconScaled,guiControl.trade.rowTop(guiControl.trade.cursorPosition+2)-pixel(2)),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;break;case 1:G.stats.illness>0&&G.inventory.money>l?(snd_heal.Play(),guiControl.trade.island.StayAtInn()):snd_cannotbuy.Play();break;default:snd_cursorup.Play(),guiControl.trade.screen="main",guiControl.trade.activateDelay=5,guiControl.trade.cursorPosition=2}guiControl.trade.activateDelay=5}ct_cancel().down&&(snd_cursorup.Play(),guiControl.trade.screen="main",guiControl.trade.activateDelay=5,guiControl.trade.cursorPosition=2)}}else"gossip"==guiControl.trade.screen&&(guiControl.trade.cursorPosition<0&&(guiControl.trade.cursorPosition=0),guiControl.trade.cursorPosition>0&&(guiControl.trade.cursorPosition=0),guiControl.drawPixelText("Gossip",guiControl.trade.padding,guiControl.topOfBackground,10,"black",6),guiControl.drawPixelText("Nothing interesting to report! / / / / / -Actually, this isnt in the game yet-",guiControl.trade.padding,guiControl.trade.rowTop(0)-pixel(2),0,"black",4),guiControl.drawPixelText("Back",guiControl.trade.leftBorder,guiControl.trade.rowTop(4)-pixel(2),8,"black",6),OS.context.drawImage(guiControl.cursor,guiControl.trade.leftBorder-guiControl.iconScaled,guiControl.trade.rowTop(4)-pixel(3)),guiControl.trade.activateDelay<=0&&(ct_confirm().down||ct_cancel().down)&&(snd_cursorup.Play(),guiControl.trade.screen="tavern",guiControl.trade.activateDelay=5,guiControl.trade.cursorPosition=0))}} \ No newline at end of file diff --git a/minified/loadAudio.js b/minified/loadAudio.js index 05f63ce..1028e47 100644 --- a/minified/loadAudio.js +++ b/minified/loadAudio.js @@ -1 +1 @@ -function loadAudio(){Oversimplified.DEBUG.showMessages&&console.log("Ran loadAudio()")}var mus_title=new OS.E.AddTune("Title",{mp3:"audio/music/title.mp3",wav:"audio/music/title.wav"}),mus_sail=new OS.E.AddTune("Sailing",{mp3:"audio/music/ocean.mp3",wav:"audio/music/ocean.wav"}),mus_trade=new OS.E.AddTune("Trade",{mp3:"audio/music/trade.mp3",wav:"audio/music/trade.wav"}),mus_credits=new OS.E.AddTune("Credits",{mp3:"audio/music/credits.mp3",wav:"audio/music/credits.wav"}),snd_buy=new OS.E.AddSound("Buy",{wav:"audio/sounds/Buy.wav",mp3:"audio/sounds/Buy.mp3"}),snd_cannotbuy=new OS.E.AddSound("Cannot Buy",{wav:"audio/sounds/Cannot_Buy.wav",mp3:"audio/sounds/Cannot_Buy.mp3"}),snd_heal=new OS.E.AddSound("Heal",{wav:"audio/sounds/Heal.wav",mp3:"audio/sounds/Heal.mp3"}),snd_illness=new OS.E.AddSound("Illness",{wav:"audio/sounds/Illness.wav",mp3:"audio/sounds/Illness.mp3"}),snd_cursordown=new OS.E.AddSound("Move Cursor Down",{wav:"audio/sounds/Move_Cursor.wav",mp3:"audio/sounds/Move_Cursor.mp3"}),snd_cursorup=new OS.E.AddSound("Move Cursor Up",{wav:"audio/sounds/Move_Cursor_Up.wav",mp3:"audio/sounds/Move_Cursor_Up.mp3"}),snd_sailing=new OS.E.AddSound("Sailing",{wav:"audio/sounds/Sailing.wav",mp3:"audio/sounds/Sailing.mp3"}),snd_select=new OS.E.AddSound("Select",{wav:"audio/sounds/Select.wav",mp3:"audio/sounds/Select.mp3"}),snd_sell=new OS.E.AddSound("Sell",{wav:"audio/sounds/Sell.wav",mp3:"audio/sounds/Sell.mp3"}),snd_wave=new OS.E.AddSound("Wave Crash",{wav:"audio/sounds/Wave_Crash.wav",mp3:"audio/sounds/Wave_Crash.mp3"}); \ No newline at end of file +function loadAudio(){}var mus_title=new OS.E.AddTune("Title",{mp3:"audio/music/title.mp3",wav:"audio/music/title.wav"}),mus_sail=new OS.E.AddTune("Sailing",{mp3:"audio/music/ocean.mp3",wav:"audio/music/ocean.wav"}),mus_trade=new OS.E.AddTune("Trade",{mp3:"audio/music/trade.mp3",wav:"audio/music/trade.wav"}),mus_credits=new OS.E.AddTune("Credits",{mp3:"audio/music/credits.mp3",wav:"audio/music/credits.wav"}),snd_buy=new OS.E.AddSound("Buy",{wav:"audio/sounds/Buy.wav",mp3:"audio/sounds/Buy.mp3"}),snd_cannotbuy=new OS.E.AddSound("Cannot Buy",{wav:"audio/sounds/Cannot_Buy.wav",mp3:"audio/sounds/Cannot_Buy.mp3"}),snd_heal=new OS.E.AddSound("Heal",{wav:"audio/sounds/Heal.wav",mp3:"audio/sounds/Heal.mp3"}),snd_illness=new OS.E.AddSound("Illness",{wav:"audio/sounds/Illness.wav",mp3:"audio/sounds/Illness.mp3"}),snd_cursordown=new OS.E.AddSound("Move Cursor Down",{wav:"audio/sounds/Move_Cursor.wav",mp3:"audio/sounds/Move_Cursor.mp3"}),snd_cursorup=new OS.E.AddSound("Move Cursor Up",{wav:"audio/sounds/Move_Cursor_Up.wav",mp3:"audio/sounds/Move_Cursor_Up.mp3"}),snd_sailing=new OS.E.AddSound("Sailing",{wav:"audio/sounds/Sailing.wav",mp3:"audio/sounds/Sailing.mp3"}),snd_select=new OS.E.AddSound("Select",{wav:"audio/sounds/Select.wav",mp3:"audio/sounds/Select.mp3"}),snd_sell=new OS.E.AddSound("Sell",{wav:"audio/sounds/Sell.wav",mp3:"audio/sounds/Sell.mp3"}),snd_wave=new OS.E.AddSound("Wave Crash",{wav:"audio/sounds/Wave_Crash.wav",mp3:"audio/sounds/Wave_Crash.mp3"}); \ No newline at end of file diff --git a/minified/loadControls.js b/minified/loadControls.js index bc3d01d..c669107 100644 --- a/minified/loadControls.js +++ b/minified/loadControls.js @@ -1 +1 @@ -function loadControls(){Oversimplified.DEBUG.showMessages&&console.log("Ran loadControls()")}function ct_up(){return{held:ct_wasd_up.held||ct_arrow_up.held,down:ct_wasd_up.down||ct_arrow_up.down,up:ct_wasd_up.up||ct_arrow_up.up}}function ct_left(){return{held:ct_wasd_left.held||ct_arrow_left.held,down:ct_wasd_left.down||ct_arrow_left.down,up:ct_wasd_left.up||ct_arrow_left.up}}function ct_down(){return{held:ct_wasd_down.held||ct_arrow_down.held,down:ct_wasd_down.down||ct_arrow_down.down,up:ct_wasd_down.up||ct_arrow_down.up}}function ct_right(){return{held:ct_wasd_right.held||ct_arrow_right.held,down:ct_wasd_right.down||ct_arrow_right.down,up:ct_wasd_right.up||ct_arrow_right.up}}function ct_confirm(){return{held:ct_space.held||ct_z.held,down:ct_space.down||ct_z.down,up:ct_space.up||ct_z.up}}function ct_cancel(){return{held:ct_shift.held||ct_x.held,down:ct_shift.down||ct_x.down,up:ct_shift.up||ct_x.up}}var ct_wasd_up=OS.C.Add("WASD Up",OS.Keycode.w),ct_wasd_left=OS.C.Add("WASD Left",OS.Keycode.a),ct_wasd_down=OS.C.Add("WASD Down",OS.Keycode.s),ct_wasd_right=OS.C.Add("WASD Right",OS.Keycode.d),ct_arrow_up=OS.C.Add("Arrow Up",OS.Keycode.up),ct_arrow_left=OS.C.Add("Arrow Left",OS.Keycode.left),ct_arrow_down=OS.C.Add("Arrow Down",OS.Keycode.down),ct_arrow_right=OS.C.Add("Arrow Right",OS.Keycode.right),ct_shift=OS.C.Add("Shift",OS.Keycode.shift),ct_space=OS.C.Add("Space",OS.Keycode.space),ct_z=OS.C.Add("Z",OS.Keycode.z),ct_x=OS.C.Add("X",OS.Keycode.x),ct_m=OS.C.Add("M",OS.Keycode.m),ct_esc=OS.C.Add("Cancel",OS.Keycode.escape); \ No newline at end of file +function loadControls(){}function ct_up(){return{held:ct_wasd_up.held||ct_arrow_up.held,down:ct_wasd_up.down||ct_arrow_up.down,up:ct_wasd_up.up||ct_arrow_up.up}}function ct_left(){return{held:ct_wasd_left.held||ct_arrow_left.held,down:ct_wasd_left.down||ct_arrow_left.down,up:ct_wasd_left.up||ct_arrow_left.up}}function ct_down(){return{held:ct_wasd_down.held||ct_arrow_down.held,down:ct_wasd_down.down||ct_arrow_down.down,up:ct_wasd_down.up||ct_arrow_down.up}}function ct_right(){return{held:ct_wasd_right.held||ct_arrow_right.held,down:ct_wasd_right.down||ct_arrow_right.down,up:ct_wasd_right.up||ct_arrow_right.up}}function ct_confirm(){return{held:ct_space.held||ct_z.held,down:ct_space.down||ct_z.down,up:ct_space.up||ct_z.up}}function ct_cancel(){return{held:ct_shift.held||ct_x.held,down:ct_shift.down||ct_x.down,up:ct_shift.up||ct_x.up}}var ct_wasd_up=OS.C.Add("WASD Up",OS.Keycode.w),ct_wasd_left=OS.C.Add("WASD Left",OS.Keycode.a),ct_wasd_down=OS.C.Add("WASD Down",OS.Keycode.s),ct_wasd_right=OS.C.Add("WASD Right",OS.Keycode.d),ct_arrow_up=OS.C.Add("Arrow Up",OS.Keycode.up),ct_arrow_left=OS.C.Add("Arrow Left",OS.Keycode.left),ct_arrow_down=OS.C.Add("Arrow Down",OS.Keycode.down),ct_arrow_right=OS.C.Add("Arrow Right",OS.Keycode.right),ct_shift=OS.C.Add("Shift",OS.Keycode.shift),ct_space=OS.C.Add("Space",OS.Keycode.space),ct_z=OS.C.Add("Z",OS.Keycode.z),ct_x=OS.C.Add("X",OS.Keycode.x),ct_m=OS.C.Add("M",OS.Keycode.m),ct_esc=OS.C.Add("Cancel",OS.Keycode.escape); \ No newline at end of file diff --git a/minified/loadGameManager.js b/minified/loadGameManager.js index 40b3dbc..80e5252 100644 --- a/minified/loadGameManager.js +++ b/minified/loadGameManager.js @@ -1 +1 @@ -function loadGameManager(){for(var e=0;e=1e6&&(e=G.inventory.money.toString().substr(0,1),parseInt(G.inventory.money.toString().substr(1,1))>0&&(e+="."+G.inventory.money.toString().substr(1,1))),G.inventory.money>=1e12?e+="T":G.inventory.money>=1e9?e+="B":G.inventory.money>=1e6?e+="M":e=G.inventory.money.toString(),e},CheckCargo:function(){for(var e=[],n=0;n0&&e.push(n);return e},CargoTotal:function(){for(var e=G.inventory.CheckCargo(),n=0,a=0;an&&(G.inventory.cargo[e]>0||G.inventory.CheckCargo().length0}},G.stats={inventory:3,hold:20,speed:1,hull:3,maxHull:3,popularity:5,haggling:10,crew:2,energy:25,maxEnergy:50,illness:0},G.economy={innCost:50,innStays:0,cargoItemWorth:[10,20,30,30,40,20,50,80,65,20,20,30,30,60,45,70],cargoSold:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],cargoBought:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],UpdateEconomy:function(){for(var e=0;e=1e6&&(e=G.inventory.money.toString().substr(0,1),parseInt(G.inventory.money.toString().substr(1,1))>0&&(e+="."+G.inventory.money.toString().substr(1,1))),G.inventory.money>=1e12?e+="T":G.inventory.money>=1e9?e+="B":G.inventory.money>=1e6?e+="M":e=G.inventory.money.toString(),e},CheckCargo:function(){for(var e=[],n=0;n0&&e.push(n);return e},CargoTotal:function(){for(var e=G.inventory.CheckCargo(),n=0,a=0;an&&(G.inventory.cargo[e]>0||G.inventory.CheckCargo().length0}},G.stats={inventory:3,hold:20,speed:1,hull:3,maxHull:3,popularity:5,haggling:10,crew:2,energy:25,maxEnergy:50,illness:0},G.economy={innCost:50,innStays:0,cargoItemWorth:[10,20,30,30,40,20,50,80,65,20,20,30,30,60,45,70],cargoSold:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],cargoBought:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],UpdateEconomy:function(){for(var e=0;eprefabsLoaded||!window.oceanRoom?setTimeout(function(){WaitForPrefabsToLoad()},.1):(G.player=rm_Ocean.AddObject(OS.P.Ship),G.oceanParticle=rm_Ocean.AddObject(OS.P["Ocean Particle"]),G.player.xBound?rm_Ocean.SetAsCurrentRoom():setTimeout(function(){WaitForPrefabsToLoad()},.1))}; \ No newline at end of file +function loadPrefabs(){OS.AddScript("prefabs/shipPrefab.js"),OS.AddScript("prefabs/islandPrefab.js"),OS.AddScript("prefabs/oceanTilePrefab.js"),OS.AddScript("prefabs/wavePrefab.js")} \ No newline at end of file diff --git a/minified/loadRooms.js b/minified/loadRooms.js index e1d30da..30fdd68 100644 --- a/minified/loadRooms.js +++ b/minified/loadRooms.js @@ -1 +1 @@ -function loadRooms(){OS.AddScript("rooms/oceanRoom.js"),rm_Load.SetAsCurrentRoom(),Oversimplified.DEBUG.showMessages&&console.log("Ran loadRooms()")}var rm_Load=OS.R.Add("Default"),rm_Ocean=OS.R.Add("Ocean Room",{width:50*pixel(64),height:44*pixel(64),backgroundColor:"#1b2632",squaresX:50,squaresY:44,squareSize:pixel(64),numberOfIslands:10,clockTimerCutoff:1/OS.S.defaultStep*60*5});rm_Ocean.speedGaugeImg=new Image,rm_Ocean.speedGaugeImg.src="images/speed_gauge_sheet.png",rm_Ocean.clockImg=new Image,rm_Ocean.clockImg.src="images/clock_sheet.png"; \ No newline at end of file +function loadRooms(){OS.AddScript("rooms/oceanRoom.js"),OS.SetRoom(rm_Ocean)}var rm_Ocean=OS.R.Add("Default",{width:50*pixel(64),height:44*pixel(64),backgroundColor:"#1b2632",squaresX:50,squaresY:44,squareSize:pixel(64),numberOfIslands:10,clockTimerCutoff:1/OS.S.defaultStep*60*5});rm_Ocean.speedGaugeImg=new Image,rm_Ocean.speedGaugeImg.src="images/speed_gauge_sheet.png",rm_Ocean.clockImg=new Image,rm_Ocean.clockImg.src="images/clock_sheet.png"; \ No newline at end of file diff --git a/minified/prefabs/islandPrefab.js b/minified/prefabs/islandPrefab.js index c4595d7..65a41f8 100644 --- a/minified/prefabs/islandPrefab.js +++ b/minified/prefabs/islandPrefab.js @@ -1 +1 @@ -function islandPrefab(){Oversimplified.DEBUG.showMessages&&console.log("Ran islandPrefab()"),prefabsLoaded++}var ani_island_1=OS.A.Add("Island 1",256,256,{}),pr_island=OS.P.Add("Island",{solid:!0,imageSrc:"images/island.png",animations:[ani_island_1],depth:-50,mapX:0,mapY:0,mapWidth:1,mapHeight:1,mapColor:"#00AB00",canTrade:!0,haggleAmount:0,timesHaggledToday:0,inventory:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],innPriceDifference:0,innStays:0,priceDifferences:[],itemsSold:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],itemsBought:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]});pr_island.DoFirst=function(){this.GetMapPosition(),this.SetUp()},pr_island.GetMapPosition=function(){this.mapX=this.x/OS.S.pixelScale/(OS.camera.width/OS.S.pixelScale),this.mapY=this.y/OS.S.pixelScale/(OS.camera.height/OS.S.pixelScale)},pr_island.SetUp=function(){for(var n=0;16>n;n++)Math.randomRange(0,100)<25&&(this.inventory[n]=Math.round(Math.randomRange(0,20)));this.AdjustPrices(),this.CheckInventory().length<4&&this.SetUp()},pr_island.AdjustPrices=function(){for(var n=0;16>n;n++)this.inventory[n]>10?this.priceDifferences[n]=-Math.round(this.inventory[n]*Math.randomRange(1,3)):this.inventory[n]<5?this.priceDifferences[n]=Math.round((10-this.inventory[n])*Math.randomRange(1,3)):this.priceDifferences[n]=Math.round(Math.randomRange(-2,2)),G.economy.cargoItemWorth[n]+this.priceDifferences[n]<0&&(this.priceDifferences[n]=-G.economy.cargoItemWorth[n]+1);var i=this.priceDifferences.slice().sort(sortNumber);this.innPriceDifference+=Math.round(Math.randomRange(i[0],i[i.length-1]))-Math.round(Math.randomRange(0,this.innStays))},pr_island.SimulateTrade=function(){for(var n=0;16>n;n++)this.inventory[n]>0?(this.inventory[n]+=Math.round(Math.randomRange(-5,5)),this.inventory[n]<0&&(this.inventory[n]=0)):Math.randomRange(0,100)<15&&(this.inventory[n]=Math.round(Math.randomRange(0,5)));this.AdjustPrices()},pr_island.NewDay=function(){this.haggleAmount=0,this.timesHaggledToday=0,this.SimulateTrade()},pr_island.CheckInventory=function(){for(var n=[],i=0;i0&&n.push(i);return n},pr_island.TradeWith=function(){mus_sail.Stop(),mus_trade.Play(),guiControl.trade.island=this,guiControl.trade.haggleAmount=0,guiControl.trade.activateDelay=5,guiControl.trade.show=!0},pr_island.SellTo=function(n,i){this.inventory[n]++,this.itemsBought[n]++,G.inventory.cargo[n]--,G.inventory.money+=i,G.economy.cargoSold[n]++},pr_island.BuyFrom=function(n,i){this.inventory[n]--,this.itemsBought[n]++,G.inventory.cargo[n]++,G.inventory.money-=i,G.economy.cargoBought[n]++},pr_island.StayAtInn=function(){this.innStays++,G.stats.illness--,G.inventory.money-=G.economy.innCost+this.innPriceDifference,G.economy.innStays++}; \ No newline at end of file +function islandPrefab(){}var ani_island_1=OS.A.Add("Island 1",256,256,{}),pr_island=OS.P.Add("Island",{solid:!0,imageSrc:"images/island.png",animations:[ani_island_1],depth:-50,mapX:0,mapY:0,mapWidth:1,mapHeight:1,mapColor:"#00AB00",canTrade:!0,haggleAmount:0,timesHaggledToday:0,inventory:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],innPriceDifference:0,innStays:0,priceDifferences:[],itemsSold:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],itemsBought:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]});pr_island.DoFirst=function(){this.GetMapPosition(),this.SetUp()},pr_island.GetMapPosition=function(){this.mapX=this.x/OS.S.pixelScale/(OS.camera.width/OS.S.pixelScale),this.mapY=this.y/OS.S.pixelScale/(OS.camera.height/OS.S.pixelScale)},pr_island.SetUp=function(){for(var n=0;16>n;n++)Math.randomRange(0,100)<25&&(this.inventory[n]=Math.round(Math.randomRange(0,20)));this.AdjustPrices(),this.CheckInventory().length<4&&this.SetUp()},pr_island.AdjustPrices=function(){for(var n=0;16>n;n++)this.inventory[n]>10?this.priceDifferences[n]=-Math.round(this.inventory[n]*Math.randomRange(1,3)):this.inventory[n]<5?this.priceDifferences[n]=Math.round((10-this.inventory[n])*Math.randomRange(1,3)):this.priceDifferences[n]=Math.round(Math.randomRange(-2,2)),G.economy.cargoItemWorth[n]+this.priceDifferences[n]<0&&(this.priceDifferences[n]=-G.economy.cargoItemWorth[n]+1);var i=this.priceDifferences.slice().sort(sortNumber);this.innPriceDifference+=Math.round(Math.randomRange(i[0],i[i.length-1]))-Math.round(Math.randomRange(0,this.innStays))},pr_island.SimulateTrade=function(){for(var n=0;16>n;n++)this.inventory[n]>0?(this.inventory[n]+=Math.round(Math.randomRange(-5,5)),this.inventory[n]<0&&(this.inventory[n]=0)):Math.randomRange(0,100)<15&&(this.inventory[n]=Math.round(Math.randomRange(0,5)));this.AdjustPrices()},pr_island.NewDay=function(){this.haggleAmount=0,this.timesHaggledToday=0,this.SimulateTrade()},pr_island.CheckInventory=function(){for(var n=[],i=0;i0&&n.push(i);return n},pr_island.TradeWith=function(){mus_sail.Stop(),mus_trade.Play(),guiControl.trade.island=this,guiControl.trade.haggleAmount=0,guiControl.trade.activateDelay=5,guiControl.trade.show=!0},pr_island.SellTo=function(n,i){this.inventory[n]++,this.itemsBought[n]++,G.inventory.cargo[n]--,G.inventory.money+=i,G.economy.cargoSold[n]++},pr_island.BuyFrom=function(n,i){this.inventory[n]--,this.itemsBought[n]++,G.inventory.cargo[n]++,G.inventory.money-=i,G.economy.cargoBought[n]++},pr_island.StayAtInn=function(){this.innStays++,G.stats.illness--,G.inventory.money-=G.economy.innCost+this.innPriceDifference,G.economy.innStays++}; \ No newline at end of file diff --git a/minified/prefabs/oceanTilePrefab.js b/minified/prefabs/oceanTilePrefab.js index 2b0fbb2..be776a3 100644 --- a/minified/prefabs/oceanTilePrefab.js +++ b/minified/prefabs/oceanTilePrefab.js @@ -1 +1 @@ -function oceanTilePrefab(){Oversimplified.DEBUG.showMessages&&console.log("Ran oceanTilePrefab()"),prefabsLoaded++}var ani_ocean=OS.A.Add("Ocean",256,256,{columns:10,speed:1/60}),pr_ocean=OS.P.Add("Ocean Particle",{imageSrc:"images/ocean_sheet.png",animations:[ani_ocean],depth:-100,positionCheckStep:30,positionCheckProgress:30,doCheckPosition:!1,moveTimer:0});pr_ocean.BeforeDo=function(){this.positionCheckProgress++,this.positionCheckProgress>=this.positionCheckStep&&(this.positionCheckProgress=0,this.doCheckPosition=!0)},pr_ocean.Do=function(){this.moveTimer++,this.moveTimer>=120&&(this.x+=1*pixel(Math.round(Math.randomRange(-1,1))),this.y+=1*pixel(Math.round(Math.randomRange(-1,1))),this.moveTimer=0)},pr_ocean.CheckPosition=function(i,e,a){if(this.doCheckPosition){if(Math.abs(this.x-i)>OS.camera.width+this.xBound||Math.abs(this.y-e)>OS.camera.height+this.yBound)switch(a){case 0:this.x=i+(OS.camera.width+this.xBound)+randomSmidge(),this.y=e+randomSmidge();break;case 45:this.x=i+(OS.camera.width+this.xBound)+randomSmidge(),this.y=e-(OS.camera.height+this.yBound)+randomSmidge();break;case 90:this.x=i+randomSmidge(),this.y=e-(OS.camera.height+this.yBound)+randomSmidge();break;case 135:this.x=i-(OS.camera.width+this.xBound)+randomSmidge(),this.y=e-(OS.camera.height+this.yBound)+randomSmidge();break;case 180:this.x=i-(OS.camera.width+this.xBound)+randomSmidge(),this.y=e+randomSmidge();break;case 225:this.x=i-(OS.camera.width+this.xBound)+randomSmidge(),this.y=e+(OS.camera.height+this.yBound)+randomSmidge();break;case 270:this.x=i+randomSmidge(),this.y=e+(OS.camera.height+this.yBound)+randomSmidge();break;case 315:this.x=i+(OS.camera.width+this.xBound)+randomSmidge(),this.y=e+(OS.camera.height+this.yBound)+randomSmidge();break;default:console.log("No valid direction")}this.doCheckPosition=!1}}; \ No newline at end of file +function oceanTilePrefab(){}var ani_ocean=OS.A.Add("Ocean",256,256,{columns:10,speed:1/60}),pr_ocean=OS.P.Add("Ocean Particle",{imageSrc:"images/ocean_sheet.png",animations:[ani_ocean],depth:-100,positionCheckStep:30,positionCheckProgress:30,doCheckPosition:!1,moveTimer:0});pr_ocean.BeforeDo=function(){this.positionCheckProgress++,this.positionCheckProgress>=this.positionCheckStep&&(this.positionCheckProgress=0,this.doCheckPosition=!0)},pr_ocean.Do=function(){this.moveTimer++,this.moveTimer>=120&&(this.x+=1*pixel(Math.round(Math.randomRange(-1,1))),this.y+=1*pixel(Math.round(Math.randomRange(-1,1))),this.moveTimer=0)},pr_ocean.CheckPosition=function(i,e,a){if(this.doCheckPosition){if(Math.abs(this.x-i)>OS.camera.width+this.xBound||Math.abs(this.y-e)>OS.camera.height+this.yBound)switch(a){case 0:this.x=i+(OS.camera.width+this.xBound)+randomSmidge(),this.y=e+randomSmidge();break;case 45:this.x=i+(OS.camera.width+this.xBound)+randomSmidge(),this.y=e-(OS.camera.height+this.yBound)+randomSmidge();break;case 90:this.x=i+randomSmidge(),this.y=e-(OS.camera.height+this.yBound)+randomSmidge();break;case 135:this.x=i-(OS.camera.width+this.xBound)+randomSmidge(),this.y=e-(OS.camera.height+this.yBound)+randomSmidge();break;case 180:this.x=i-(OS.camera.width+this.xBound)+randomSmidge(),this.y=e+randomSmidge();break;case 225:this.x=i-(OS.camera.width+this.xBound)+randomSmidge(),this.y=e+(OS.camera.height+this.yBound)+randomSmidge();break;case 270:this.x=i+randomSmidge(),this.y=e+(OS.camera.height+this.yBound)+randomSmidge();break;case 315:this.x=i+(OS.camera.width+this.xBound)+randomSmidge(),this.y=e+(OS.camera.height+this.yBound)+randomSmidge();break;default:console.log("No valid direction")}this.doCheckPosition=!1}}; \ No newline at end of file diff --git a/minified/prefabs/shipPrefab.js b/minified/prefabs/shipPrefab.js index bdfa089..c4d5dae 100644 --- a/minified/prefabs/shipPrefab.js +++ b/minified/prefabs/shipPrefab.js @@ -1 +1 @@ -function shipPrefab(){Oversimplified.DEBUG.showMessages&&console.log("Ran shipPrefab()"),prefabsLoaded++}var ani_ship_r=OS.A.Add("Ship Right",64,64,{columns:2,speed:1/60,yOffset:256}),ani_ship_ur=OS.A.Add("Ship Up-Right",64,64,{columns:2,speed:1/60,yOffset:448}),ani_ship_u=OS.A.Add("Ship Up",64,64,{columns:2,speed:1/60,yOffset:320}),ani_ship_ul=OS.A.Add("Ship Up-Left",64,64,{columns:2,speed:1/60,yOffset:384}),ani_ship_l=OS.A.Add("Ship Left",64,64,{columns:2,speed:1/60,yOffset:192}),ani_ship_dl=OS.A.Add("Ship Down-Left",64,64,{columns:2,speed:1/60,yOffset:64}),ani_ship_d=OS.A.Add("Ship Down",64,64,{columns:2,speed:1/60,yOffset:0}),ani_ship_dr=OS.A.Add("Ship Down-Right",64,64,{columns:2,speed:1/60,yOffset:128}),pr_ship=OS.P.Add("Ship",{solid:!0,imageSrc:"images/ship_sheet.png",maskImageSrc:"images/ship_mask.png",animations:[ani_ship_r,ani_ship_ur,ani_ship_u,ani_ship_ul,ani_ship_l,ani_ship_dl,ani_ship_d,ani_ship_dr],direction:0,currentSpeed:0,pointInFront:{x:0,y:0},moveStepSize:3,moveStepAmount:5*OS.R[OS.R.currentRoom].stepSpeed,moveStepProgress:0,doTakeStep:!1,energyRefillTimer:0,drawSickIndicator:0,drawSickIndicatorTime:secondsWorthOfFrames(1.5)});pr_ship.BeforeDo=function(){G.gameStarted&&this.GetMapPosition()},pr_ship.Do=function(){G.gameStarted&&(guiControl&&guiControl.inventory&&guiControl.map&&guiControl.trade&&(guiControl.inventory.show||guiControl.map.show||guiControl.trade.show||(ct_left().down?this.direction+=45:ct_right().down&&(this.direction-=45),this.direction=Math.clampAngle(this.direction),ct_up().down?this.currentSpeed++:ct_down().down&&this.currentSpeed--,this.AdjustSpeedBasedOnEnergy(),this.CheckInteraction())),this.currentSpeed=Math.clamp(this.currentSpeed,0,4),this.moveStepProgress+=this.currentSpeed*this.moveStepAmount,this.moveStepProgress>=this.moveStepSize?(this.moveStepProgress-=this.moveStepSize,this.doTakeStep=!0):this.doTakeStep=!1,this.SeamlessScroll())},pr_ship.AfterDo=function(){G.gameStarted&&(this.CheckMovement(),this.UpdateEnergy())},pr_ship.DrawAbove=function(){if(G.gameStarted&&(this.drawSickIndicator--,this.drawSickIndicator<0&&(this.drawSickIndicator=0),this.drawSickIndicator>0)){var t=Math.round((this.drawSickIndicatorTime-this.drawSickIndicator)/2)/OS.S.pixelScale,i=this.y-t-Oversimplified.camera.y-guiControl.iconScaled/2;guiControl.drawIcon(4,1,this.x-Oversimplified.camera.x-guiControl.iconScaled/2,i)}},pr_ship.GetMapPosition=function(){this.mapX=pixel(Math.round(this.x/pixel(64))),this.mapY=pixel(Math.round(this.y/pixel(64)))},pr_ship.CheckInteraction=function(){if(ct_confirm().down){var t=OS.GameObjectsAtPoint(this.pointInFront.x,this.pointInFront.y);if(t.length>0)for(var i=0;i=100/G.stats.crew+G.stats.illness*(100/G.stats.crew)&&(G.stats.energy+=G.stats.crew,this.energyRefillTimer=0),this.doTakeStep&&(G.stats.energy-=.25*(this.currentSpeed/G.stats.speed+.1*G.stats.illness)),G.stats.energy<0&&(G.stats.energy=0),G.stats.energy>G.stats.maxEnergy&&(G.stats.energy=G.stats.maxEnergy)},pr_ship.SeamlessScroll=function(){this.x<=rm_Ocean.mapLeftTrigger?(this.x=rm_Ocean.mapLeftTriggerTarget,OS.SetCamera({x:rm_Ocean.width})):this.x>=rm_Ocean.mapRightTrigger?(this.x=rm_Ocean.mapRightTriggerTarget,OS.SetCamera({x:0})):this.y<=rm_Ocean.mapUpTrigger?(this.y=rm_Ocean.mapUpTriggerTarget,OS.SetCamera({y:rm_Ocean.height})):this.y>=rm_Ocean.mapDownTrigger&&(this.y=rm_Ocean.mapDownTriggerTarget,OS.SetCamera({y:0}))},pr_ship.AdjustSpeedBasedOnEnergy=function(){(this.currentSpeed>3&&G.stats.energy<.3*G.stats.maxEnergy||this.currentSpeed>2&&G.stats.energy<.15*G.stats.maxEnergy||this.currentSpeed>1&&G.stats.energy<.05*G.stats.maxEnergy)&&this.currentSpeed--},pr_ship.CheckIllnessIncrease=function(){var t=G.stats.crew+this.currentSpeed/(G.stats.energy+.001)*G.stats.illness;Math.randomRange(0,100)=this.moveStepSize?(this.moveStepProgress-=this.moveStepSize,this.doTakeStep=!0):this.doTakeStep=!1,this.SeamlessScroll())},pr_ship.AfterDo=function(){G.gameStarted&&(this.CheckMovement(),this.UpdateEnergy())},pr_ship.DrawAbove=function(){if(G.gameStarted&&(this.drawSickIndicator--,this.drawSickIndicator<0&&(this.drawSickIndicator=0),this.drawSickIndicator>0)){var t=Math.round((this.drawSickIndicatorTime-this.drawSickIndicator)/2)/OS.S.pixelScale,i=this.y-t-Oversimplified.camera.y-guiControl.iconScaled/2;guiControl.drawIcon(4,1,this.x-Oversimplified.camera.x-guiControl.iconScaled/2,i)}},pr_ship.GetMapPosition=function(){this.mapX=pixel(Math.round(this.x/pixel(64))),this.mapY=pixel(Math.round(this.y/pixel(64)))},pr_ship.CheckInteraction=function(){if(ct_confirm().down){var t=OS.GameObjectsAtPoint(this.pointInFront.x,this.pointInFront.y);if(t.length>0)for(var i=0;i=100/G.stats.crew+G.stats.illness*(100/G.stats.crew)&&(G.stats.energy+=G.stats.crew,this.energyRefillTimer=0),this.doTakeStep&&(G.stats.energy-=.25*(this.currentSpeed/G.stats.speed+.1*G.stats.illness)),G.stats.energy<0&&(G.stats.energy=0),G.stats.energy>G.stats.maxEnergy&&(G.stats.energy=G.stats.maxEnergy)},pr_ship.SeamlessScroll=function(){this.x<=rm_Ocean.mapLeftTrigger?(this.x=rm_Ocean.mapLeftTriggerTarget,OS.SetCamera({x:rm_Ocean.width})):this.x>=rm_Ocean.mapRightTrigger?(this.x=rm_Ocean.mapRightTriggerTarget,OS.SetCamera({x:0})):this.y<=rm_Ocean.mapUpTrigger?(this.y=rm_Ocean.mapUpTriggerTarget,OS.SetCamera({y:rm_Ocean.height})):this.y>=rm_Ocean.mapDownTrigger&&(this.y=rm_Ocean.mapDownTriggerTarget,OS.SetCamera({y:0}))},pr_ship.AdjustSpeedBasedOnEnergy=function(){(this.currentSpeed>3&&G.stats.energy<.3*G.stats.maxEnergy||this.currentSpeed>2&&G.stats.energy<.15*G.stats.maxEnergy||this.currentSpeed>1&&G.stats.energy<.05*G.stats.maxEnergy)&&this.currentSpeed--},pr_ship.CheckIllnessIncrease=function(){var t=G.stats.crew+this.currentSpeed/(G.stats.energy+.001)*G.stats.illness;Math.randomRange(0,100)rm_Ocean.clockTimerCutoff){rm_Ocean.clockTimerCount=0,G.economy.UpdateEconomy();for(var e=0;ee&&(e=0),e>0){var a=OS.context.globalAlpha,r=Oversimplified.context.fillStyle;OS.context.globalAlpha=e,Oversimplified.context.fillStyle="#112189",Oversimplified.context.fillRect(0,0,Oversimplified.camera.width,Oversimplified.camera.height),Oversimplified.context.fillStyle=r,Oversimplified.context.globalAlpha=a}},rm_Ocean.DrawEnergyBar=function(){var e=G.stats.energy/G.stats.maxEnergy,a=pixel(2),r=32,t=pixel(Math.round(r*e)),i=OS.context.fillStyle;OS.context.fillStyle="#0055FF",OS.context.fillRect(64,OS.camera.height-a-16,t,a),OS.context.fillStyle=i},rm_Ocean.DrawClock=function(){var e=OS.camera.width-pixel(9)-pixel(2),a=OS.camera.height-pixel(9)-pixel(2),r=this.clockTimerCount/this.clockTimerCutoff,t=Math.floor(16*r)*pixel(9);OS.context.drawImage(this.clockImg,t,0,pixel(9),pixel(9),e,a,pixel(9),pixel(9))},rm_Ocean.GenerateMap=function(){for(var e=[25],a=[22];e.lengthrm_Ocean.clockTimerCutoff){rm_Ocean.clockTimerCount=0,G.economy.UpdateEconomy();for(var e=0;ee&&(e=0),e>0){var a=OS.context.globalAlpha,r=Oversimplified.context.fillStyle;OS.context.globalAlpha=e,Oversimplified.context.fillStyle="#112189",Oversimplified.context.fillRect(0,0,Oversimplified.camera.width,Oversimplified.camera.height),Oversimplified.context.fillStyle=r,Oversimplified.context.globalAlpha=a}},rm_Ocean.DrawEnergyBar=function(){var e=G.stats.energy/G.stats.maxEnergy,a=pixel(2),r=32,t=pixel(Math.round(r*e)),i=OS.context.fillStyle;OS.context.fillStyle="#0055FF",OS.context.fillRect(64,OS.camera.height-a-16,t,a),OS.context.fillStyle=i},rm_Ocean.DrawClock=function(){var e=OS.camera.width-pixel(9)-pixel(2),a=OS.camera.height-pixel(9)-pixel(2),r=this.clockTimerCount/this.clockTimerCutoff,t=Math.floor(16*r)*pixel(9);OS.context.drawImage(this.clockImg,t,0,pixel(9),pixel(9),e,a,pixel(9),pixel(9))},rm_Ocean.GenerateMap=function(){for(var e=[25],a=[22];e.length