Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base: 75289107b8
...
compare: 6465f6f076
Checking mergeability… Don't worry, you can still create the pull request.
  • 3 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 25 additions and 8 deletions.
  1. +25 −8 index.html
View
33 index.html
@@ -16,7 +16,6 @@
<script src="../player/anm.collisions.js" type="text/javascript"></script>
<script src="../player/anm.builder.js" type="text/javascript"></script>
<script src="../player/animatron_import.js" type="text/javascript"></script>
- <!--<script src="anm.SAT.js" type="text/javascript"></script>-->
<script type="text/javascript">
function start() {
anm.M.collisions.pathDriven = true;
@@ -119,7 +118,7 @@
chainscores = 1;
};
- var circleClicked = function (evt, time) {
+ var circleClicked = function (evt) {
if (clicks > 0 && this.$.contains(evt.pos)) {
this.dead = true;
startChain();
@@ -203,6 +202,7 @@
var scene = b("scene");
+
var welcomeScreen = b("welcomeScreen");
welcomeScreen
.text([WIDTH/2, HEIGHT/2], "Click to start!", 32, "Arial")
@@ -220,16 +220,33 @@
gameScreen
.add(levelHolder)
.add(clicksHUD)
- .add(scoreHUD);
+ .add(scoreHUD)
+ .on(C.X_KPRESS, function(evt) {
+ if (evt.key === 114) {
+ restartCurrentLevel();
+ }
+ });
+ var restartCurrentLevel = function() {
+ clicks = 3;
+ chainscores = 0;
+ prevscores = 0;
+ scores = scoresBeforeLevel;
+ clicksHUD.v.xdata.text.lines = "Clicks: " + clicks;
+ startLevel(currentLevelTemplate);
+ };
- var currentLevel;
+ var activeLevel;
+ var currentLevelTemplate;
+
+ var scoresBeforeLevel;
var startLevel = function (level) {
- var newLevel = b(level);
- levelHolder.remove(currentLevel);
+ scoresBeforeLevel = scores;
+ currentLevelTemplate = level;
+ var newLevel = b(currentLevelTemplate);
+ if (activeLevel) levelHolder.remove(activeLevel);
levelHolder.add(newLevel);
- currentLevel = newLevel;
+ activeLevel = newLevel;
};
-
var player = createPlayer('gameCanvas', {'mode':C.M_DYNAMIC, 'cnvs':{"bgfill": { color: "#000" },'width':WIDTH, 'height':HEIGHT}});
player.load(scene).play();
}

No commit comments for this range

Something went wrong with that request. Please try again.