Skip to content

Commit

Permalink
Finding more strings
Browse files Browse the repository at this point in the history
  • Loading branch information
pippinbarr committed Apr 4, 2023
1 parent 7633fe6 commit 97366cf
Show file tree
Hide file tree
Showing 14 changed files with 264 additions and 134 deletions.
166 changes: 162 additions & 4 deletions assets/json/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
}
},
"gameover": "GAME OVER",
"youwin": "YOU WIN",
"youlose": "YOU LOSE",
"points": "POINTS"
},
"snakes": {
Expand All @@ -54,7 +56,12 @@
},
"Capitalism": {
"title": "Capitalism",
"key": "Capitalism"
"key": "Capitalism",
"cantafford": [
"YOU CAN'T AFFORD",
"THE APPLE"
],
"diedwith": "DIED WITH $"
},
"Casualism": {
"title": "Casualism",
Expand All @@ -70,7 +77,22 @@
},
"Dualism": {
"title": "Dualism",
"key": "Dualism"
"key": "Dualism",
"keyboard": [
"ARROWS",
"CONTROL",
"SNAKE BODY"
],
"touch": [
"SWIPES",
"CONTROL",
"SNAKE BODY"
],
"mind": [
"MIND",
"CONTROLS",
"SNAKE MIND"
]
},
"Existentialism": {
"title": "Existentialism",
Expand All @@ -82,7 +104,12 @@
},
"Idealism": {
"title": "Idealism",
"key": "Idealism"
"key": "Idealism",
"instruction": [
"IMAGINE YOU ARE",
"PLAYING A GAME",
"OF SNAKE"
]
},
"Monism": {
"title": "Monism",
Expand Down Expand Up @@ -114,7 +141,138 @@
},
"Romanticism": {
"title": "Romanticism",
"key": "Romanticism"
"key": "Romanticism",
"deathtexts": [
[
"NOW I HAVE FOUND YOU",
"",
"MY SWEET OBLIVION"
],
[
"NOW I AM WITH YOU",
"",
"MY LOVE"
],
[
"NOW WE CAN BE",
"",
"TOGETHER AT LAST"
],
[
"THE MERCY OF THIS",
"",
"SUDDEN SILENCE"
],
[
"YOU ARE WITH ME NOW",
"",
"MY ANGEL"
],
[
"THIS FINAL DARKNESS",
"",
"SUCH SWEET SOLACE"
],
[
"I SEE A LIGHT",
"",
"AND KNOW YOU ARE THERE"
],
[
"I AM COMING TO YOU NOW",
"",
"MY DARLING"
],
[
"NOW WE WILL ALWAYS",
"",
"BE AS ONE"
]
],
"appletexts": [
[
"I THINK OF YOU",
"",
"EVERY MOMENT"
],
[
"THE PLEASURES OF EARTH",
"",
"ARE EMPTY",
"",
"WITHOUT YOUR GRACE"
],
[
"THERE WAS NO",
"",
"SWEETER APPLE",
"",
"THAN YOU, MY LOVE"
],
[
"WHAT JOY IS EATING",
"",
"WITHOUT YOU",
"",
"TO SHARE IT WITH?"
],
[
"FOOD IS LIKE ASHES",
"",
"KNOWING YOU ARE GONE"
],
[
"I MISS YOUR",
"",
"MYSTERIOUS SMILE",
"",
"SO MUCH"
],
[
"LIFE WITHOUT YOU",
"",
"IS BARELY LIVING",
"",
"AT ALL"
],
[
"I CAN BARELY EAT",
"",
"KNOWING I CANNOT",
"",
"SEE YOU AGAIN"
],
[
"WHY DID YOU LEAVE ME?",
"",
"I CANNOT STAND",
"",
"THIS EMPTY LIFE"
],
[
"THE DISTRACTIONS OF",
"",
"FOOD AND WINE",
"",
"ARE NOTHING TO ME"
],
[
"HOW CAN YOU",
"",
"BE GONE",
"",
"WHEN I NEED YOU",
"",
"WITH ME?"
],
[
"OH THAT THIS APPLE",
"",
"COULD MAKE ME SLEEP",
"",
"FOREVER"
]
]
},
"Stoicism": {
"title": "Stoicism",
Expand Down
12 changes: 0 additions & 12 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@

window.onload = function () {

console.log(Phaser)

const config = {
type: Phaser.AUTO,
width: 480,
Expand Down Expand Up @@ -113,16 +111,6 @@

};

if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('./sw.js')
.then(function (registration) {
console.log('Service Worker Registered');
});

navigator.serviceWorker.ready.then(function (registration) {
console.log('Service Worker Ready');
});
}

document.addEventListener(
"keydown",
Expand Down
20 changes: 11 additions & 9 deletions js/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@ BasicGame.Menu.prototype.create = function () {
games.push(this.strings.snakes[keys[i]].title);
this.menuItems.push(this.strings.snakes[keys[i]]);
}
games.push("");
this.menuItems.push({});
games.push(this.strings.menu.homepage);
this.menuItems.push({
title: `pippinbarr.com`,
url: `this.strings.menu.homepage`
});

console.log(games);
if (mode !== `kiosk`) {
games.push("");
this.menuItems.push({});
games.push(this.strings.menu.homepage);
this.menuItems.push({
title: `pippinbarr.com`,
url: `this.strings.menu.homepage`
});
}

this.menuButtons = this.game.add.group();
this.menuText = this.game.add.group();

Expand Down Expand Up @@ -108,7 +110,7 @@ BasicGame.Menu.prototype.update = function () {
this.checkMenuCollision();
if (this.snake[0].x > this.game.width) {
if (this.selected.title == "pippinbarr.com") {
window.location = "http://www.pippinbarr.com/";
window.open("http://www.pippinbarr.com/", "_blank");
}
else {
this.game.state.start(this.selected.key);
Expand Down
7 changes: 4 additions & 3 deletions js/Preloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ BasicGame.Preloader = function (game) {
};

let lang = `en`;
let mode = `normal`;

BasicGame.Preloader.prototype = {

preload: function () {
Expand All @@ -32,10 +34,9 @@ BasicGame.Preloader.prototype = {
this.load.audio('apple', ['assets/sounds/apple.mp3', 'assets/sounds/apple.ogg']);
this.load.audio('move', ['assets/sounds/move.mp3', 'assets/sounds/move.ogg']);

console.log(window.location.search);
const params = new URLSearchParams(window.location.search);
console.log(params.get(`lang`))
const lang = params.get(`lang`) || `en`;
mode = params.get(`mode`) || false
lang = params.get(`lang`) || `en`;
this.load.json('strings', `assets/json/${lang}.json`);
},

Expand Down
6 changes: 3 additions & 3 deletions js/snakes/Apocalypticism.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
BasicGame.Apocalypticism = function (game) {
BasicGame.Snake.call(this,game);
BasicGame.Snake.call(this, game);
};

BasicGame.Apocalypticism.prototype = Object.create(BasicGame.Snake.prototype);
Expand All @@ -18,6 +18,6 @@ BasicGame.Apocalypticism.prototype.create = function () {
this.controlsGroup.visible = false;
this.dead = true;
this.setScoreText("");
this.setGameOverText("GAME OVER","","","","");
}.bind(this),Math.floor(Math.random() * 30000))
this.setGameOverText(this.strings.ui.gameover, "", "", "", "");
}.bind(this), Math.floor(Math.random() * 30000))
};
6 changes: 3 additions & 3 deletions js/snakes/Asceticism.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
BasicGame.Asceticism = function (game) {
BasicGame.Snake.call(this,game);
BasicGame.Snake.call(this, game);
};

BasicGame.Asceticism.prototype = Object.create(BasicGame.Snake.prototype);
Expand Down Expand Up @@ -37,9 +37,9 @@ BasicGame.Asceticism.prototype.checkAppleCollision = function () {

BasicGame.Asceticism.prototype.gameOver = function () {
if (this.ateApple) {
this.setGameOverText("GAME OVER","","YOU LOSE","","");
this.setGameOverText(this.strings.ui.gameover, "", this.strings.ui.youlose, "", "");
}
else {
this.setGameOverText("GAME OVER","",this.score + " POINTS","","");
this.setGameOverText(this.strings.ui.gameover, "", this.score + " " + this.strings.ui.points, "", "");
}
};
18 changes: 9 additions & 9 deletions js/snakes/Capitalism.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
BasicGame.Capitalism = function (game) {
BasicGame.Snake.call(this,game);
BasicGame.Snake.call(this, game);
};

BasicGame.Capitalism.prototype = Object.create(BasicGame.Snake.prototype);
Expand All @@ -16,10 +16,10 @@ BasicGame.Capitalism.prototype.setScoreText = function (scoreString) {

scoreString = "$" + scoreString;
if (scoreString.length < this.MAX_SCORE.toString().length) {
var spacesToAdd = (this.MAX_SCORE.toString().length - scoreString.length)+1;
var spacesToAdd = (this.MAX_SCORE.toString().length - scoreString.length) + 1;
scoreString = Array(spacesToAdd).join(" ") + scoreString;
}
this.addTextToGrid(this.scoreX-scoreString.length,this.scoreY,[scoreString]);
this.addTextToGrid(this.scoreX - scoreString.length, this.scoreY, [scoreString]);
};

BasicGame.Capitalism.prototype.checkAppleCollision = function () {
Expand All @@ -33,16 +33,16 @@ BasicGame.Capitalism.prototype.checkAppleCollision = function () {
this.addToScore(-this.APPLE_SCORE);
}
else {
this.addTextToGrid(3,5,["YOU CAN'T AFFORD","THE APPLE"]);
this.addTextToGrid(3, 5, this.strings.snakes.Capitalism.cantafford);
this.hitSFX.play();
this.game.time.events.add(Phaser.Timer.SECOND * this.SNAKE_TICK * 10,function () {
this.addTextToGrid(3,5,[" "," "]);
},this);
this.game.time.events.add(Phaser.Timer.SECOND * this.SNAKE_TICK * 10, function () {
this.addTextToGrid(3, 5, [" ", " "]);
}, this);
}
}
};

BasicGame.Capitalism.prototype.gameOver = function () {
this.addTextToGrid(3,5,[" "," "])
this.setGameOverText("GAME OVER","","DIED WITH $" + this.score,"","");
this.addTextToGrid(3, 5, [" ", " "])
this.setGameOverText(this.strings.ui.gameover, "", this.strings.snakes.Capitalism.diedwith + this.score, "", "");
};

0 comments on commit 97366cf

Please sign in to comment.