From 8e63729d17ee0cb14355dd2caa2039b031032124 Mon Sep 17 00:00:00 2001 From: copy Date: Sat, 14 Sep 2013 18:29:39 +0200 Subject: [PATCH] various changes --- cc.sh | 10 ++++++---- engine.js | 13 +++++++++---- index.html | 36 +++++++++++++++++++----------------- iwbtc-all.js | 29 ----------------------------- keyboard.js | 6 +----- schnosm.js | 6 ++++-- style.css | 9 +++++---- 7 files changed, 44 insertions(+), 65 deletions(-) delete mode 100644 iwbtc-all.js diff --git a/cc.sh b/cc.sh index ab747df..05c9c6b 100755 --- a/cc.sh +++ b/cc.sh @@ -1,17 +1,19 @@ -IN="storage.js clone.js engine.js audio.js bitmap.js game_objects.js keyboard.js renderer.js util.js schosm.js" +IN="storage.js clone.js engine.js audio.js bitmap.js game_objects.js keyboard.js renderer.js util.js schnosm.js" OUT="iwbtc-all.js" -ls -l $OUT +ls -lh $OUT + +#--compilation_level ADVANCED_OPTIMIZATIONS\ java -jar ~/closure-compiler.jar \ - --compilation_level ADVANCED_OPTIMIZATIONS\ --js_output_file $OUT\ --warning_level VERBOSE\ --externs externs.js\ + --define=DEBUG=false\ --language_in ECMASCRIPT5_STRICT\ --js $IN #echo $FILENAME -ls -l $OUT +ls -lh $OUT diff --git a/engine.js b/engine.js index 393ba54..beb4143 100644 --- a/engine.js +++ b/engine.js @@ -1,21 +1,28 @@ "use strict"; +/** @define */ +var DEBUG = true; +/** @const */ var RIGHT = 0, LEFT = 1; +/** @const */ var NOT_FALLING = 0, IN_JUMP = 1, FALLING = 2; +/** @const */ var GAME_WIDTH = 800, GAME_HEIGHT = 600; +/** @const */ var FIRST_LEVEL = "level1.js", LEVEL_DIR = "levels/"; +/** @const */ var STORAGE_NO_AUDIO = "no_audio", STORAGE_LEVEL = "last_level", STORAGE_STATE = "state"; @@ -25,7 +32,7 @@ window.addEventListener("load", function() { var ge = new GameEngine; - if(location.host === "localhost" && window.LevelEditor) + if(DEBUG && location.host === "localhost" && window.LevelEditor) { new LevelEditor(ge); } @@ -113,9 +120,7 @@ function GameEngine() document.getElementById("reset_save").addEventListener("click", function() { - self.levelFile = FIRST_LEVEL; - self.storage.removeItem(STORAGE_STATE); - self.loadLevel(FIRST_LEVEL); + self.nextLevel(FIRST_LEVEL); }, false); diff --git a/index.html b/index.html index f2efcc0..d2b019c 100644 --- a/index.html +++ b/index.html @@ -2,15 +2,7 @@ I Wanna Be Thy Copy - - - - - - - - - + @@ -34,12 +26,22 @@

Thy Copy : Thy Game


     Default keys (click to change):
- Left Arrow - Move left
- Right Arrow - Move right
- Space - Jump
- T - Shoot
- R - Restart
- M - Mute sound + + + +
+ Left Arrow - Move left
+
+ Space - Jump
+
+ R - Restart
+
+ Right Arrow - Move right
+
+ T - Shoot
+
+ M - Mute sound +