From b4d5bff3fcd8a77c7de355dd00cf38dc05d50bc0 Mon Sep 17 00:00:00 2001 From: RedEnchilada Date: Thu, 12 May 2016 22:06:19 -0500 Subject: [PATCH] Add function to move to a new level --- level/Level.js | 9 +++++++++ other/Memory.js | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/level/Level.js b/level/Level.js index 4686a11..476e884 100644 --- a/level/Level.js +++ b/level/Level.js @@ -136,6 +136,10 @@ Level = function(levelName) { if (wipe.x < 600) { wipe.x += 15; + + if (wipe.x > -30 && wipe.newlevel) { + Memory.loadStage(); + } } if (level.map.save && !level.saved && dolphin.position.z < -30 && dolphin.momentum.y > 0) { @@ -151,6 +155,11 @@ Level = function(levelName) { } } + level.moveLevels = function() { + wipe.x = -630; + wipe.newlevel = true; + } + function cameraThinker() { // Camera thinker. var targetX, targetY; diff --git a/other/Memory.js b/other/Memory.js index d1724c7..77d8048 100644 --- a/other/Memory.js +++ b/other/Memory.js @@ -64,9 +64,13 @@ Memory = (function() { } if (gotomap) { - Game.setScene(Level(data.lastStage)); + Memory.loadStage(); } } + Memory.loadStage = function() { + Game.setScene(Level(data.lastStage)); + } + return Memory; })(); \ No newline at end of file