Update code styles and spacing

This commit is contained in:
Robbie Antenesse 2019-02-13 12:11:30 -07:00
parent 27e95d4011
commit 7b8729d4e0
19 changed files with 2074 additions and 1995 deletions

View File

@ -6,7 +6,7 @@ guiControl.inventory = {
screen: "main", screen: "main",
cursorPosition: 0, cursorPosition: 0,
show: false, show: false,
activateDelay: 0 activateDelay: 0,
} }
guiControl.inventory.Draw = function () { guiControl.inventory.Draw = function () {
@ -59,23 +59,27 @@ guiControl.inventory.Draw = function () {
if (guiControl.inventory.activateDelay <= 0) { if (guiControl.inventory.activateDelay <= 0) {
if (ct_confirm().down) { if (ct_confirm().down) {
switch (guiControl.inventory.cursorPosition) { switch (guiControl.inventory.cursorPosition) {
case 0: case 0: {
snd_select.Play(); snd_select.Play();
guiControl.inventory.screen = "money"; guiControl.inventory.screen = "money";
break; break;
case 1: }
case 1: {
snd_select.Play(); snd_select.Play();
guiControl.inventory.screen = "cargo"; guiControl.inventory.screen = "cargo";
break; break;
case 2: }
case 2: {
snd_select.Play(); snd_select.Play();
guiControl.inventory.screen = "status"; guiControl.inventory.screen = "status";
break; break;
default: }
default: {
snd_cursorup.Play(); snd_cursorup.Play();
guiControl.inventory.show = false; guiControl.inventory.show = false;
break; break;
} }
}
guiControl.inventory.cursorPosition = 0; guiControl.inventory.cursorPosition = 0;
guiControl.inventory.activateDelay = 5; guiControl.inventory.activateDelay = 5;

View File

@ -4,7 +4,7 @@ function mapGUI() {
guiControl.map = { guiControl.map = {
show: false, show: false,
activateDelay: 0 activateDelay: 0,
} }
guiControl.map.Draw = function () { guiControl.map.Draw = function () {

View File

@ -13,7 +13,7 @@ guiControl.title = {
rowTop: function (rowNumber) { rowTop: function (rowNumber) {
return pixel(32) + pixel(2) + pixel((guiControl.iconSize + 2) * rowNumber); return pixel(32) + pixel(2) + pixel((guiControl.iconSize + 2) * rowNumber);
} },
} }
guiControl.title.Draw = function () { guiControl.title.Draw = function () {
@ -56,7 +56,7 @@ guiControl.title.Draw = function () {
if (guiControl.title.activateDelay <= 0) { if (guiControl.title.activateDelay <= 0) {
if (ct_confirm().down) { if (ct_confirm().down) {
switch (guiControl.title.cursorPosition) { switch (guiControl.title.cursorPosition) {
case 0: case 0: {
snd_select.Play(); snd_select.Play();
mus_title.Stop(); mus_title.Stop();
mus_sail.Play(); mus_sail.Play();
@ -64,7 +64,8 @@ guiControl.title.Draw = function () {
G.gameStarted = true; G.gameStarted = true;
G.SaveGame(); G.SaveGame();
break; break;
case 1: }
case 1: {
if (G.savedGameExists) { // once loading is in, allow this. if (G.savedGameExists) { // once loading is in, allow this.
G.LoadGame(); G.LoadGame();
snd_select.Play(); snd_select.Play();
@ -76,7 +77,8 @@ guiControl.title.Draw = function () {
snd_cannotbuy.Play(); snd_cannotbuy.Play();
} }
break; break;
case 2: }
case 2: {
if (false) { // once loading is in, allow this. if (false) { // once loading is in, allow this.
snd_select.Play(); snd_select.Play();
guiControl.title.show = false; guiControl.title.show = false;
@ -86,6 +88,7 @@ guiControl.title.Draw = function () {
snd_cannotbuy.Play(); snd_cannotbuy.Play();
} }
} }
}
guiControl.title.cursorPosition = 0; guiControl.title.cursorPosition = 0;
// console.log(guiControl.title.screen); // console.log(guiControl.title.screen);

View File

@ -17,7 +17,7 @@ guiControl.trade = {
rowTop: function (rowNumber) { rowTop: function (rowNumber) {
return (guiControl.trade.padding + pixel(6) + (guiControl.trade.padding * 3)) + pixel((guiControl.iconSize + 3) * rowNumber); return (guiControl.trade.padding + pixel(6) + (guiControl.trade.padding * 3)) + pixel((guiControl.iconSize + 3) * rowNumber);
} },
} }
guiControl.trade.Draw = function () { guiControl.trade.Draw = function () {
@ -86,7 +86,7 @@ guiControl.trade.Draw = function () {
if (guiControl.trade.activateDelay <= 0) { if (guiControl.trade.activateDelay <= 0) {
if (ct_confirm().down) { if (ct_confirm().down) {
switch (guiControl.trade.cursorPosition) { switch (guiControl.trade.cursorPosition) {
case 0: case 0: {
if (guiControl.trade.island.CheckInventory().length > 0) { if (guiControl.trade.island.CheckInventory().length > 0) {
snd_select.Play(); snd_select.Play();
guiControl.trade.screen = "buy"; guiControl.trade.screen = "buy";
@ -96,7 +96,8 @@ guiControl.trade.Draw = function () {
snd_cannotbuy.Play(); snd_cannotbuy.Play();
} }
break; break;
case 1: }
case 1: {
if (G.inventory.CheckCargo().length > 0) { if (G.inventory.CheckCargo().length > 0) {
snd_select.Play(); snd_select.Play();
guiControl.trade.screen = "sell"; guiControl.trade.screen = "sell";
@ -105,18 +106,21 @@ guiControl.trade.Draw = function () {
snd_cannotbuy.Play(); snd_cannotbuy.Play();
} }
break; break;
case 2: }
case 2: {
snd_select.Play(); snd_select.Play();
guiControl.trade.screen = "tavern"; guiControl.trade.screen = "tavern";
guiControl.trade.activateDelay = 5; guiControl.trade.activateDelay = 5;
break; break;
default: }
default: {
snd_cursorup.Play(); snd_cursorup.Play();
mus_trade.Stop(); mus_trade.Stop();
mus_sail.Play(); mus_sail.Play();
guiControl.trade.show = false; guiControl.trade.show = false;
break; break;
} }
}
// snd_select.Play(); // snd_select.Play();
guiControl.trade.cursorPosition = 0; guiControl.trade.cursorPosition = 0;
@ -196,7 +200,7 @@ guiControl.trade.Draw = function () {
if (guiControl.trade.activateDelay <= 0) { if (guiControl.trade.activateDelay <= 0) {
if (ct_confirm().down) { if (ct_confirm().down) {
switch (guiControl.trade.cursorPosition) { switch (guiControl.trade.cursorPosition) {
case 0: // Haggle 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 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. 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.
{ {
@ -207,7 +211,8 @@ guiControl.trade.Draw = function () {
guiControl.trade.island.timesHaggledToday++; guiControl.trade.island.timesHaggledToday++;
} }
break; break;
case 1: // Buy }
case 1: { // Buy
if (items.length > 0 && if (items.length > 0 &&
G.inventory.CanBuy(items[guiControl.trade.page], itemPrice) && 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. guiControl.trade.island.CanBuyFrom(items[guiControl.trade.page], itemPrice)) //If cursor is over yes and you can buy, buy it.
@ -218,13 +223,15 @@ guiControl.trade.Draw = function () {
snd_cannotbuy.Play(); snd_cannotbuy.Play();
} }
break; break;
default: }
default: {
snd_cursorup.Play(); snd_cursorup.Play();
guiControl.trade.screen = "main"; guiControl.trade.screen = "main";
guiControl.trade.activateDelay = 5; guiControl.trade.activateDelay = 5;
guiControl.trade.cursorPosition = 0; // The position where "Buy" is on main screen. guiControl.trade.cursorPosition = 0; // The position where "Buy" is on main screen.
break; break;
} }
}
// console.log(guiControl.trade.screen); // console.log(guiControl.trade.screen);
} }
if (ct_cancel().down) { if (ct_cancel().down) {
@ -303,7 +310,7 @@ guiControl.trade.Draw = function () {
if (guiControl.trade.activateDelay <= 0) { if (guiControl.trade.activateDelay <= 0) {
if (ct_confirm().down) { if (ct_confirm().down) {
switch (guiControl.trade.cursorPosition) { switch (guiControl.trade.cursorPosition) {
case 0: // Haggle case 0: { // Haggle
if (items.length > 0 && (guiControl.trade.island.timesHaggledToday <= G.stats.popularity) && 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. 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.
{ {
@ -314,7 +321,8 @@ guiControl.trade.Draw = function () {
guiControl.trade.island.timesHaggledToday++; guiControl.trade.island.timesHaggledToday++;
} }
break; break;
case 1: // Sell }
case 1: { // Sell
if (items.length > 0 && if (items.length > 0 &&
G.inventory.CanSell(items[guiControl.trade.page]) && 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. guiControl.trade.island.CanSellTo(items[guiControl.trade.page], itemPrice)) //If cursor is over yes and you can buy, buy it.
@ -325,13 +333,15 @@ guiControl.trade.Draw = function () {
snd_cannotbuy.Play(); snd_cannotbuy.Play();
} }
break; break;
default: }
default: {
snd_cursorup.Play(); snd_cursorup.Play();
guiControl.trade.screen = "main"; guiControl.trade.screen = "main";
guiControl.trade.activateDelay = 5; guiControl.trade.activateDelay = 5;
guiControl.trade.cursorPosition = 1; // The position where "Sell" is on main screen. guiControl.trade.cursorPosition = 1; // The position where "Sell" is on main screen.
break; break;
} }
}
// console.log(guiControl.trade.screen); // console.log(guiControl.trade.screen);
} }
if (ct_cancel().down) { if (ct_cancel().down) {
@ -379,13 +389,14 @@ guiControl.trade.Draw = function () {
if (guiControl.trade.activateDelay <= 0) { if (guiControl.trade.activateDelay <= 0) {
if (ct_confirm().down) { if (ct_confirm().down) {
switch (guiControl.trade.cursorPosition) { switch (guiControl.trade.cursorPosition) {
case 0: case 0: {
snd_select.Play(); snd_select.Play();
guiControl.trade.screen = "gossip"; guiControl.trade.screen = "gossip";
guiControl.trade.activateDelay = 5; guiControl.trade.activateDelay = 5;
guiControl.trade.cursorPosition = 2; // The position where "Supplies" is on main screen. guiControl.trade.cursorPosition = 2; // The position where "Supplies" is on main screen.
break; break;
case 1: }
case 1: {
if (G.stats.illness > 0 && G.inventory.money > innPrice) { //If cursor is over yes, heal illness with supplies. if (G.stats.illness > 0 && G.inventory.money > innPrice) { //If cursor is over yes, heal illness with supplies.
snd_heal.Play(); snd_heal.Play();
guiControl.trade.island.StayAtInn(); guiControl.trade.island.StayAtInn();
@ -393,13 +404,15 @@ guiControl.trade.Draw = function () {
snd_cannotbuy.Play(); snd_cannotbuy.Play();
} }
break; break;
default: }
default: {
snd_cursorup.Play(); snd_cursorup.Play();
guiControl.trade.screen = "main"; guiControl.trade.screen = "main";
guiControl.trade.activateDelay = 5; guiControl.trade.activateDelay = 5;
guiControl.trade.cursorPosition = 2; // The position where "Supplies" is on main screen. guiControl.trade.cursorPosition = 2; // The position where "Supplies" is on main screen.
break; break;
} }
}
// Give a cooldown so you don't accidentally do something you don't want. // Give a cooldown so you don't accidentally do something you don't want.
guiControl.trade.activateDelay = 5; guiControl.trade.activateDelay = 5;

View File

@ -41,12 +41,15 @@
<section> <section>
<h2> <h2>
<a id="about" class="anchor" href="#about" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>About</h2> <a id="about" class="anchor" href="#about" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>
About
</h2>
<p>This page contains the in-dev version of the game, and the most recent stable version will be <a href="https://alamantus-gamedev.itch.io/trade-winds">on Itch.io</a>.</p> <p>This page contains the in-dev version of the game, and the most recent stable version will be <a href="https://alamantus-gamedev.itch.io/trade-winds">on Itch.io</a>.</p>
<h2> <h2>
<a id="controls" class="anchor" href="#controls" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Controls</h2> <a id="controls" class="anchor" href="#controls" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Controls
</h2>
<strong>In-Game Controls</strong> <strong>In-Game Controls</strong>
<ul> <ul>
@ -104,8 +107,7 @@
<footer> <footer>
<p><small>Hosted on <a href="https://pages.github.com">GitHub Pages</a> using the Dinky theme</small></p> <p><small>Hosted on <a href="https://pages.github.com">GitHub Pages</a> using the Dinky theme</small></p>
</footer> </footer>
</div> </div>
<!--[if !IE]><script>fixScale(document);</script><![endif]--> <!--[if !IE]><script>fixScale(document);</script><![endif]-->
</body>
</body>
</html> </html>

View File

@ -16,5 +16,4 @@ fixScale = function(doc) {
scales = [.25, 1.6]; scales = [.25, 1.6];
doc[addEvent](type, fix, true); doc[addEvent](type, fix, true);
} }
}; };

View File

@ -22,7 +22,7 @@ function ct_up () {
return { return {
held : ct_wasd_up.held || ct_arrow_up.held, held : ct_wasd_up.held || ct_arrow_up.held,
down : ct_wasd_up.down || ct_arrow_up.down, down : ct_wasd_up.down || ct_arrow_up.down,
up : ct_wasd_up.up || ct_arrow_up.up up : ct_wasd_up.up || ct_arrow_up.up,
} }
} }
@ -30,7 +30,7 @@ function ct_left () {
return { return {
held : ct_wasd_left.held || ct_arrow_left.held, held : ct_wasd_left.held || ct_arrow_left.held,
down : ct_wasd_left.down || ct_arrow_left.down, down : ct_wasd_left.down || ct_arrow_left.down,
up : ct_wasd_left.up || ct_arrow_left.up up : ct_wasd_left.up || ct_arrow_left.up,
} }
} }
@ -38,7 +38,7 @@ function ct_down () {
return { return {
held : ct_wasd_down.held || ct_arrow_down.held, held : ct_wasd_down.held || ct_arrow_down.held,
down : ct_wasd_down.down || ct_arrow_down.down, down : ct_wasd_down.down || ct_arrow_down.down,
up : ct_wasd_down.up || ct_arrow_down.up up : ct_wasd_down.up || ct_arrow_down.up,
} }
} }
@ -46,7 +46,7 @@ function ct_right () {
return { return {
held : ct_wasd_right.held || ct_arrow_right.held, held : ct_wasd_right.held || ct_arrow_right.held,
down : ct_wasd_right.down || ct_arrow_right.down, down : ct_wasd_right.down || ct_arrow_right.down,
up : ct_wasd_right.up || ct_arrow_right.up up : ct_wasd_right.up || ct_arrow_right.up,
} }
} }
@ -54,7 +54,7 @@ function ct_confirm () {
return { return {
held : ct_space.held || ct_z.held, held : ct_space.held || ct_z.held,
down : ct_space.down || ct_z.down, down : ct_space.down || ct_z.down,
up : ct_space.up || ct_z.up up : ct_space.up || ct_z.up,
} }
} }
@ -62,6 +62,6 @@ function ct_cancel () {
return { return {
held : ct_shift.held || ct_x.held, held : ct_shift.held || ct_x.held,
down : ct_shift.down || ct_x.down, down : ct_shift.down || ct_x.down,
up : ct_shift.up || ct_x.up up : ct_shift.up || ct_x.up,
} }
} }

View File

@ -165,175 +165,217 @@ guiControl.drawPixelText = function (text, x, y, wrapWidth, color, size) {
for (var i = 0; i < text.length; i++) { for (var i = 0; i < text.length; i++) {
var letterCellX, letterCellY; var letterCellX, letterCellY;
switch (text.charAt(i)) { switch (text.charAt(i)) {
case "A": case "A": {
letterCellX = 0; letterCellX = 0;
letterCellY = 0; letterCellY = 0;
break; break;
case "B": }
case "B": {
letterCellX = 1; letterCellX = 1;
letterCellY = 0; letterCellY = 0;
break; break;
case "C": }
case "C": {
letterCellX = 2; letterCellX = 2;
letterCellY = 0; letterCellY = 0;
break; break;
case "D": }
case "D": {
letterCellX = 3; letterCellX = 3;
letterCellY = 0; letterCellY = 0;
break; break;
case "E": }
case "E": {
letterCellX = 4; letterCellX = 4;
letterCellY = 0; letterCellY = 0;
break; break;
case "F": }
case "F": {
letterCellX = 5; letterCellX = 5;
letterCellY = 0; letterCellY = 0;
break; break;
case "G": }
case "G": {
letterCellX = 0; letterCellX = 0;
letterCellY = 1; letterCellY = 1;
break; break;
case "H": }
case "H": {
letterCellX = 1; letterCellX = 1;
letterCellY = 1; letterCellY = 1;
break; break;
case "I": }
case "I": {
letterCellX = 2; letterCellX = 2;
letterCellY = 1; letterCellY = 1;
break; break;
case "J": }
case "J": {
letterCellX = 3; letterCellX = 3;
letterCellY = 1; letterCellY = 1;
break; break;
case "K": }
case "K": {
letterCellX = 4; letterCellX = 4;
letterCellY = 1; letterCellY = 1;
break; break;
case "L": }
case "L": {
letterCellX = 5; letterCellX = 5;
letterCellY = 1; letterCellY = 1;
break; break;
case "M": }
case "M": {
letterCellX = 0; letterCellX = 0;
letterCellY = 2; letterCellY = 2;
break; break;
case "N": }
case "N": {
letterCellX = 1; letterCellX = 1;
letterCellY = 2; letterCellY = 2;
break; break;
case "O": }
case "O": {
letterCellX = 2; letterCellX = 2;
letterCellY = 2; letterCellY = 2;
break; break;
case "P": }
case "P": {
letterCellX = 3; letterCellX = 3;
letterCellY = 2; letterCellY = 2;
break; break;
case "Q": }
case "Q": {
letterCellX = 4; letterCellX = 4;
letterCellY = 2; letterCellY = 2;
break; break;
case "R": }
case "R": {
letterCellX = 5; letterCellX = 5;
letterCellY = 2; letterCellY = 2;
break; break;
case "S": }
case "S": {
letterCellX = 0; letterCellX = 0;
letterCellY = 3; letterCellY = 3;
break; break;
case "T": }
case "T": {
letterCellX = 1; letterCellX = 1;
letterCellY = 3; letterCellY = 3;
break; break;
case "U": }
case "U": {
letterCellX = 2; letterCellX = 2;
letterCellY = 3; letterCellY = 3;
break; break;
case "V": }
case "V": {
letterCellX = 3; letterCellX = 3;
letterCellY = 3; letterCellY = 3;
break; break;
case "W": }
case "W": {
letterCellX = 4; letterCellX = 4;
letterCellY = 3; letterCellY = 3;
break; break;
case "X": }
case "X": {
letterCellX = 5; letterCellX = 5;
letterCellY = 3; letterCellY = 3;
break; break;
case "Y": }
case "Y": {
letterCellX = 0; letterCellX = 0;
letterCellY = 4; letterCellY = 4;
break; break;
case "Z": }
case "Z": {
letterCellX = 1; letterCellX = 1;
letterCellY = 4; letterCellY = 4;
break; break;
case "1": }
case "1": {
letterCellX = 2; letterCellX = 2;
letterCellY = 4; letterCellY = 4;
break; break;
case "2": }
case "2": {
letterCellX = 3; letterCellX = 3;
letterCellY = 4; letterCellY = 4;
break; break;
case "3": }
case "3": {
letterCellX = 4; letterCellX = 4;
letterCellY = 4; letterCellY = 4;
break; break;
case "4": }
case "4": {
letterCellX = 5; letterCellX = 5;
letterCellY = 4; letterCellY = 4;
break; break;
case "5": }
case "5": {
letterCellX = 0; letterCellX = 0;
letterCellY = 5; letterCellY = 5;
break; break;
case "6": }
case "6": {
letterCellX = 1; letterCellX = 1;
letterCellY = 5; letterCellY = 5;
break; break;
case "7": }
case "7": {
letterCellX = 2; letterCellX = 2;
letterCellY = 5; letterCellY = 5;
break; break;
case "8": }
case "8": {
letterCellX = 3; letterCellX = 3;
letterCellY = 5; letterCellY = 5;
break; break;
case "9": }
case "9": {
letterCellX = 4; letterCellX = 4;
letterCellY = 5; letterCellY = 5;
break; break;
case "0": }
case "0": {
letterCellX = 5; letterCellX = 5;
letterCellY = 5; letterCellY = 5;
break; break;
case ".": }
case ".": {
letterCellX = 0; letterCellX = 0;
letterCellY = 6; letterCellY = 6;
break; break;
case ",": }
case ",": {
letterCellX = 1; letterCellX = 1;
letterCellY = 6; letterCellY = 6;
break; break;
case "-": }
case "-": {
letterCellX = 2; letterCellX = 2;
letterCellY = 6; letterCellY = 6;
break; break;
case "?": }
case "?": {
letterCellX = 3; letterCellX = 3;
letterCellY = 6; letterCellY = 6;
break; break;
case "!": }
case "!": {
letterCellX = 4; letterCellX = 4;
letterCellY = 6; letterCellY = 6;
break; break;
default: // Default to Space }
default: {// Default to Space
letterCellX = 5; letterCellX = 5;
letterCellY = 6; letterCellY = 6;
break; break;
} }
}
var lineNumber = Math.floor(i/wrapWidth); var lineNumber = Math.floor(i/wrapWidth);
var horizontal = i - (wrapWidth * lineNumber); var horizontal = i - (wrapWidth * lineNumber);

View File

@ -75,7 +75,7 @@ G.stats = {
crew: 2, // How many crew members you have. Influences how fast your energy recovers. crew: 2, // How many crew members you have. Influences how fast your energy recovers.
energy: 25, // Drains rate determined by current speed. When drained, currentSpeed reduces until you have enough energy to continue. energy: 25, // Drains rate determined by current speed. When drained, currentSpeed reduces until you have enough energy to continue.
maxEnergy: 50, // How much to refill your energy to. Can increase with upgrades. maxEnergy: 50, // How much to refill your energy to. Can increase with upgrades.
illness: 0 // Your crew's overall health. When this is low, your ship slows down. illness: 0, // Your crew's overall health. When this is low, your ship slows down.
}; };
G.economy = { // Aww yea, supply and demand. G.economy = { // Aww yea, supply and demand.
@ -113,7 +113,7 @@ G.economy = { // Aww yea, supply and demand.
} }
G.economy.innCost += Math.round(totalInnCost / G.map.length); // Apply the average inn price. G.economy.innCost += Math.round(totalInnCost / G.map.length); // Apply the average inn price.
// console.log(G.economy.cargoItemWorth); // console.log(G.economy.cargoItemWorth);
} },
}; };
G.SaveGame = function () { G.SaveGame = function () {
@ -134,16 +134,16 @@ G.SaveGame = function () {
crew: G.stats.crew, crew: G.stats.crew,
energy: G.stats.energy, energy: G.stats.energy,
maxEnergy: G.stats.maxEnergy, maxEnergy: G.stats.maxEnergy,
illness: G.stats.illness illness: G.stats.illness,
}, },
economy: { economy: {
innCost: G.economy.innCost, innCost: G.economy.innCost,
innStays: G.economy.innStays, innStays: G.economy.innStays,
itemWorth: G.economy.cargoItemWorth.slice(), itemWorth: G.economy.cargoItemWorth.slice(),
cargoSold: G.economy.cargoSold.slice(), cargoSold: G.economy.cargoSold.slice(),
cargoBought: G.economy.cargoBought.slice() cargoBought: G.economy.cargoBought.slice(),
}, },
map: [] map: [],
}; };
for (var i = 0; i < G.map.length; i++) { for (var i = 0; i < G.map.length; i++) {
saveObject.map.push({ saveObject.map.push({
@ -156,7 +156,7 @@ G.SaveGame = function () {
innStays: G.map[i].island.innStays, innStays: G.map[i].island.innStays,
priceDifferences: G.map[i].island.priceDifferences.slice(), priceDifferences: G.map[i].island.priceDifferences.slice(),
itemsSold: G.map[i].island.itemsSold.slice(), itemsSold: G.map[i].island.itemsSold.slice(),
itemsBought: G.map[i].island.itemsBought.slice() itemsBought: G.map[i].island.itemsBought.slice(),
}); });
} }

View File

@ -15,8 +15,7 @@ function loadPrefabs() {
// Callback function that prevents Ocean room from loading before everything it references is loaded. // Callback function that prevents Ocean room from loading before everything it references is loaded.
WaitForPrefabsToLoad = function () { WaitForPrefabsToLoad = function () {
console.log("waiting for " + (prefabsToLoad - prefabsLoaded).toString() + " prefabs to load"); console.log("waiting for " + (prefabsToLoad - prefabsLoaded).toString() + " prefabs to load");
if (prefabsLoaded < prefabsToLoad || !window["oceanRoom"]) if (prefabsLoaded < prefabsToLoad || !window["oceanRoom"]) {
{
setTimeout(function(){WaitForPrefabsToLoad()}, 0.1); setTimeout(function(){WaitForPrefabsToLoad()}, 0.1);
} else { } else {
// Create player and ocean objects in rm_Ocean. // Create player and ocean objects in rm_Ocean.

View File

@ -8,7 +8,7 @@ var rm_Ocean = OS.R.Add("Ocean Room", {
squaresY: 44, squaresY: 44,
squareSize: pixel(64), squareSize: pixel(64),
numberOfIslands: 10, numberOfIslands: 10,
clockTimerCutoff: ((1 / OS.S.defaultStep) * 60) * 5 // 5 minute day. clockTimerCutoff: ((1 / OS.S.defaultStep) * 60) * 5, // 5 minute day.
}); });
function loadRooms() { function loadRooms() {

View File

@ -59,7 +59,7 @@ var pr_island = OS.P.Add("Island", {
storage: [0, 0, 0, 0, storage: [0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0] 0, 0, 0, 0],
}); });
pr_island.DoFirst = function () { pr_island.DoFirst = function () {

View File

@ -1,4 +1,4 @@
var ani_ocean = OS.A.Add("Ocean", 256, 256, {columns: 10, speed: 1/60}); var ani_ocean = OS.A.Add("Ocean", 256, 256, { columns: 10, speed: 1/60 });
function oceanTilePrefab() { function oceanTilePrefab() {
if (Oversimplified.DEBUG.showMessages) console.log("Ran oceanTilePrefab()"); if (Oversimplified.DEBUG.showMessages) console.log("Ran oceanTilePrefab()");
@ -41,43 +41,52 @@ pr_ocean.CheckPosition = function (checkX, checkY, direction) {
(Math.abs(this.y - checkY) > (OS.camera.height + this.yBound))) (Math.abs(this.y - checkY) > (OS.camera.height + this.yBound)))
{ {
switch (direction) { switch (direction) {
case 0: case 0: {
this.x = checkX + (OS.camera.width + this.xBound) + randomSmidge(); this.x = checkX + (OS.camera.width + this.xBound) + randomSmidge();
this.y = checkY + randomSmidge(); this.y = checkY + randomSmidge();
break; break;
case 45: }
case 45: {
this.x = checkX + (OS.camera.width + this.xBound) + randomSmidge(); this.x = checkX + (OS.camera.width + this.xBound) + randomSmidge();
this.y = checkY - (OS.camera.height + this.yBound) + randomSmidge(); this.y = checkY - (OS.camera.height + this.yBound) + randomSmidge();
break; break;
case 90: }
case 90: {
this.x = checkX + randomSmidge(); this.x = checkX + randomSmidge();
this.y = checkY - (OS.camera.height + this.yBound) + randomSmidge(); this.y = checkY - (OS.camera.height + this.yBound) + randomSmidge();
break; break;
case 135: }
case 135: {
this.x = checkX - (OS.camera.width + this.xBound) + randomSmidge(); this.x = checkX - (OS.camera.width + this.xBound) + randomSmidge();
this.y = checkY - (OS.camera.height + this.yBound) + randomSmidge(); this.y = checkY - (OS.camera.height + this.yBound) + randomSmidge();
break; break;
case 180: }
case 180: {
this.x = checkX - (OS.camera.width + this.xBound) + randomSmidge(); this.x = checkX - (OS.camera.width + this.xBound) + randomSmidge();
this.y = checkY + randomSmidge(); this.y = checkY + randomSmidge();
break; break;
case 225: }
case 225: {
this.x = checkX - (OS.camera.width + this.xBound) + randomSmidge(); this.x = checkX - (OS.camera.width + this.xBound) + randomSmidge();
this.y = checkY + (OS.camera.height + this.yBound) + randomSmidge(); this.y = checkY + (OS.camera.height + this.yBound) + randomSmidge();
break; break;
case 270: }
case 270: {
this.x = checkX + randomSmidge(); this.x = checkX + randomSmidge();
this.y = checkY + (OS.camera.height + this.yBound) + randomSmidge(); this.y = checkY + (OS.camera.height + this.yBound) + randomSmidge();
break; break;
case 315: }
case 315: {
this.x = checkX + (OS.camera.width + this.xBound) + randomSmidge(); this.x = checkX + (OS.camera.width + this.xBound) + randomSmidge();
this.y = checkY + (OS.camera.height + this.yBound) + randomSmidge(); this.y = checkY + (OS.camera.height + this.yBound) + randomSmidge();
break; break;
default: }
default: {
console.log("No valid direction"); console.log("No valid direction");
break; break;
} }
} }
}
this.doCheckPosition = false; this.doCheckPosition = false;
} }

View File

@ -29,7 +29,7 @@ var pr_ship = OS.P.Add("Ship", {
energyRefillTimer: 0, energyRefillTimer: 0,
drawSickIndicator: 0, drawSickIndicator: 0,
drawSickIndicatorTime: secondsWorthOfFrames(1.5) drawSickIndicatorTime: secondsWorthOfFrames(1.5),
}); });
pr_ship.BeforeDo = function () { pr_ship.BeforeDo = function () {
@ -120,58 +120,67 @@ pr_ship.CheckMovement = function () {
var moveAmount = pixel(G.stats.speed + this.currentSpeed); var moveAmount = pixel(G.stats.speed + this.currentSpeed);
var movedSuccessfully = false; var movedSuccessfully = false;
switch (this.direction) { switch (this.direction) {
case 0: case 0: {
if (this.sprite.currentAnimation != "Ship Right") this.SetAnimation("Ship Right"); if (this.sprite.currentAnimation != "Ship Right") this.SetAnimation("Ship Right");
if (this.doTakeStep) movedSuccessfully = this.SimpleMove(moveAmount, 0, true, pixel(4)); if (this.doTakeStep) movedSuccessfully = this.SimpleMove(moveAmount, 0, true, pixel(4));
this.pointInFront.x = this.x + this.xBound + pixel(2) + moveAmount; this.pointInFront.x = this.x + this.xBound + pixel(2) + moveAmount;
this.pointInFront.y = this.y; this.pointInFront.y = this.y;
break; break;
case 45: }
case 45: {
if (this.sprite.currentAnimation != "Ship Up-Right") this.SetAnimation("Ship Up-Right"); if (this.sprite.currentAnimation != "Ship Up-Right") this.SetAnimation("Ship Up-Right");
if (this.doTakeStep) movedSuccessfully = this.SimpleMove(moveAmount, -moveAmount, true, pixel(4)); if (this.doTakeStep) movedSuccessfully = this.SimpleMove(moveAmount, -moveAmount, true, pixel(4));
this.pointInFront.x = this.x + this.xBound + pixel(2) + moveAmount; this.pointInFront.x = this.x + this.xBound + pixel(2) + moveAmount;
this.pointInFront.y = this.y - this.yBound - pixel(2) - moveAmount; this.pointInFront.y = this.y - this.yBound - pixel(2) - moveAmount;
break; break;
case 90: }
case 90: {
if (this.sprite.currentAnimation != "Ship Up") this.SetAnimation("Ship Up"); if (this.sprite.currentAnimation != "Ship Up") this.SetAnimation("Ship Up");
if (this.doTakeStep) movedSuccessfully = this.SimpleMove(0, -moveAmount, true, pixel(4)); if (this.doTakeStep) movedSuccessfully = this.SimpleMove(0, -moveAmount, true, pixel(4));
this.pointInFront.x = this.x; this.pointInFront.x = this.x;
this.pointInFront.y = this.y - this.yBound - pixel(2) - moveAmount; this.pointInFront.y = this.y - this.yBound - pixel(2) - moveAmount;
break; break;
case 135: }
case 135: {
if (this.sprite.currentAnimation != "Ship Up-Left") this.SetAnimation("Ship Up-Left"); if (this.sprite.currentAnimation != "Ship Up-Left") this.SetAnimation("Ship Up-Left");
if (this.doTakeStep) movedSuccessfully = this.SimpleMove(-moveAmount, -moveAmount, true, pixel(4)); if (this.doTakeStep) movedSuccessfully = this.SimpleMove(-moveAmount, -moveAmount, true, pixel(4));
this.pointInFront.x = this.x - this.xBound - pixel(2) - moveAmount; this.pointInFront.x = this.x - this.xBound - pixel(2) - moveAmount;
this.pointInFront.y = this.y - this.yBound - pixel(2) - moveAmount; this.pointInFront.y = this.y - this.yBound - pixel(2) - moveAmount;
break; break;
case 180: }
case 180: {
if (this.sprite.currentAnimation != "Ship Left") this.SetAnimation("Ship Left"); if (this.sprite.currentAnimation != "Ship Left") this.SetAnimation("Ship Left");
if (this.doTakeStep) movedSuccessfully = this.SimpleMove(-moveAmount, 0, true, pixel(4)); if (this.doTakeStep) movedSuccessfully = this.SimpleMove(-moveAmount, 0, true, pixel(4));
this.pointInFront.x = this.x - this.xBound - pixel(2) - moveAmount; this.pointInFront.x = this.x - this.xBound - pixel(2) - moveAmount;
this.pointInFront.y = this.y; this.pointInFront.y = this.y;
break; break;
case 225: }
case 225: {
if (this.sprite.currentAnimation != "Ship Down-Left") this.SetAnimation("Ship Down-Left"); if (this.sprite.currentAnimation != "Ship Down-Left") this.SetAnimation("Ship Down-Left");
if (this.doTakeStep) movedSuccessfully = this.SimpleMove(-moveAmount, moveAmount, true, pixel(4)); if (this.doTakeStep) movedSuccessfully = this.SimpleMove(-moveAmount, moveAmount, true, pixel(4));
this.pointInFront.x = this.x - this.xBound - pixel(2) - moveAmount; this.pointInFront.x = this.x - this.xBound - pixel(2) - moveAmount;
this.pointInFront.y = this.y + this.yBound + pixel(2) + moveAmount; this.pointInFront.y = this.y + this.yBound + pixel(2) + moveAmount;
break; break;
case 270: }
case 270: {
if (this.sprite.currentAnimation != "Ship Down") this.SetAnimation("Ship Down"); if (this.sprite.currentAnimation != "Ship Down") this.SetAnimation("Ship Down");
if (this.doTakeStep) movedSuccessfully = this.SimpleMove(0, moveAmount, true, pixel(4)); if (this.doTakeStep) movedSuccessfully = this.SimpleMove(0, moveAmount, true, pixel(4));
this.pointInFront.x = this.x; this.pointInFront.x = this.x;
this.pointInFront.y = this.y + this.yBound + pixel(2) + moveAmount; this.pointInFront.y = this.y + this.yBound + pixel(2) + moveAmount;
break; break;
case 315: }
case 315: {
if (this.sprite.currentAnimation != "Ship Down-Right") this.SetAnimation("Ship Down-Right"); if (this.sprite.currentAnimation != "Ship Down-Right") this.SetAnimation("Ship Down-Right");
if (this.doTakeStep) movedSuccessfully = this.SimpleMove(moveAmount, moveAmount, true, pixel(4)); if (this.doTakeStep) movedSuccessfully = this.SimpleMove(moveAmount, moveAmount, true, pixel(4));
this.pointInFront.x = this.x + this.xBound + pixel(2) + moveAmount; this.pointInFront.x = this.x + this.xBound + pixel(2) + moveAmount;
this.pointInFront.y = this.y + this.yBound + pixel(2) + moveAmount; this.pointInFront.y = this.y + this.yBound + pixel(2) + moveAmount;
break; break;
default: }
default: {
console.log("No valid direction"); console.log("No valid direction");
break; break;
} }
}
if (this.doTakeStep && !movedSuccessfully) { if (this.doTakeStep && !movedSuccessfully) {
this.currentSpeed = 0; this.currentSpeed = 0;

View File

@ -24,7 +24,7 @@ rm_Ocean.DoFirst = function () {
OS.SetCamera({ OS.SetCamera({
x: G.player.x - (OS.camera.width / 2), x: G.player.x - (OS.camera.width / 2),
y: G.player.y - (OS.camera.height / 2), y: G.player.y - (OS.camera.height / 2),
objectToFollow: G.player objectToFollow: G.player,
}); });
this.mapLeftTrigger = OS.camera.hBorder; this.mapLeftTrigger = OS.camera.hBorder;
@ -171,7 +171,7 @@ rm_Ocean.GenerateMap = function () {
drawX: xSquares[i], drawX: xSquares[i],
drawY: ySquares[i], drawY: ySquares[i],
drawWidth: 1, drawWidth: 1,
drawHeight: 1 drawHeight: 1,
}; };
} }
} }

View File

@ -6,10 +6,10 @@ OS.SetCamera({
width: pixel(160), // 640 width: pixel(160), // 640
height: pixel(120), // 480 height: pixel(120), // 480
hBorder: pixel(64), hBorder: pixel(64),
vBorder: pixel(48)}); vBorder: pixel(48),
});
function start() function start() {
{
OS.AddScript("loadControls.js"); OS.AddScript("loadControls.js");
OS.AddScript("loadAudio.js"); OS.AddScript("loadAudio.js");
OS.AddScript("loadGameManager.js"); OS.AddScript("loadGameManager.js");

View File

@ -34,7 +34,6 @@ body {
margin: 0; margin: 0;
line-height: 1.8em; line-height: 1.8em;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
} }
h1, h2, h3, h4, h5, h6 { h1, h2, h3, h4, h5, h6 {