Skip to content

Commit

Permalink
created runner that doesn't require hosted php/sql backend.
Browse files Browse the repository at this point in the history
My old site is down so I refactored this code so it can run without a hosted backend to maintain high scores and resources.
  • Loading branch information
abell25 committed Jul 1, 2019
1 parent d3ca491 commit b990081
Show file tree
Hide file tree
Showing 4 changed files with 1,049 additions and 10 deletions.
12 changes: 6 additions & 6 deletions EndOfLevel.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ function EndOfLevel() {
this.retryButton = new Button(0, 220, CANVAS_WIDTH/2, 60, "retry?");
this.nextButton = new Button(CANVAS_WIDTH/2, 220, CANVAS_WIDTH/2, 60, "next level");
debug("buttons init! score:----------->" + this.score);
if (game_info["level"+levelManager.currentLevel]<this.score){
if (game_info["level"+levelManager.currentLevel]<this.score){
this.newHiScore = true;
game_info["level"+levelManager.currentLevel] = this.score;
updateHighScore(game_info["id"], this.score, levelManager.currentLevel);
} else {
this.newHiScore = false;
}
game_info["level"+levelManager.currentLevel] = this.score;
updateHighScore(game_info["id"], this.score, levelManager.currentLevel);
} else {
this.newHiScore = false;
}
}

this.update = function() {
Expand Down
9 changes: 5 additions & 4 deletions ajaxCalls.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
var wordList = [];

function getWordList() {
debug("starting ajax call.");
debug("getting word list.");
//We need to make a async call to get words from getKeyValPair.php
ajaxCall("https://www.anthonybell.net/code/js/LangApp/apptastic/getKeyValPair.php", fillWordList);
//ajaxCall("code/js/LangApp/apptastic/getKeyValPair.php", fillWordList);
wordList = language_pairs;
return wordList;
}
function updateHighScore(id, newHiScore, level) {
debug("updating highscore");
//debug("https://www.anthonybell.net/code/js/LangApp/apptastic/updateHiScore.php?id=" + id + "&newHiScore=" + newHiScore + "&level=" + level);
ajaxCall("https://www.anthonybell.net/code/js/LangApp/apptastic/updateHiScore.php?id=" + id + "&newHiScore=" + newHiScore + "&level=" + level, scoreUpdated);
//ajaxCall("code/js/LangApp/apptastic/updateHiScore.php?id=" + id + "&newHiScore=" + newHiScore + "&level=" + level, scoreUpdated);
}
var obj;
function ajaxCall(url, callback) {
Expand Down
37 changes: 37 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

<!DOCTYPE HTML 5>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="Style.css">
<script type="text/javascript" src="spanish_english_with_audio.js"> </script>
<script type="text/javascript" src="util.js"> </script>
<script type="text/javascript" src="ajaxCalls.js"> </script>
<script type="text/javascript" src="Button.js"> </script>
<script type="text/javascript" src="Events.js"> </script>
<script type="text/javascript" src="Score.js"> </script>
<script type="text/javascript" src="Timer.js"> </script>
<script type="text/javascript" src="ball.js"> </script>
<script type="text/javascript" src="Cursor.js"> </script>
<script type="text/javascript" src="TileBoard.js"> </script>
<script type="text/javascript" src="GameBoard.js"> </script>
<script type="text/javascript" src="EndOfLevel.js"> </script>
<script type="text/javascript" src="StartMenu.js"> </script>
<script type="text/javascript" src="GameOverMenu.js"> </script>
<script type="text/javascript" src="LevelManager.js"> </script>
<script type="text/javascript" src="CanvasApp.js"> </script>
<script>game_info={'id': 'None', 'name': 'None'};</script>
<title>Facebook App</title>
</head>
<body>
<h1>Langapp Facebook App</h1>
<audio id="GameAudio">
<source type="audio/mpeg" />
Your browser does not support the audio element.
</audio>
<canvas id="GameCanvas" width="500" height="300" > </canvas>

<footer>Copyright 2012</footer>
<div id="debug" style="font-family:Courier"> </div>
</body>
</html>
Loading

0 comments on commit b990081

Please sign in to comment.