diff options
Diffstat (limited to 'src/paperflight/static/levels.js')
| -rw-r--r-- | src/paperflight/static/levels.js | 64 | 
1 files changed, 29 insertions, 35 deletions
| diff --git a/src/paperflight/static/levels.js b/src/paperflight/static/levels.js index 8ba4a0d..e1628b1 100644 --- a/src/paperflight/static/levels.js +++ b/src/paperflight/static/levels.js @@ -1,42 +1,36 @@  /**   * Creates the levels object for the game   */ -var levels = { -    2: { -        coinsNeeded: 0, +function createLevel(title, coinsNeeded, exitX, exitY) { +    return { +        items: [constructBlock(0, 0, 800, 30)],          exit: { -            x: 40, -            y: 460, +            x: exitX, +            y: exitY,              radius: 20          }, -        title: "Switch madness", -        items: [ -            constructSwitch(120, 400, 60, 60, 3), -            constructRect(300, 400, 60, 60, 0), -            constructRect(400, 400, 60, 60, 1), -            constructRect(500, 400, 60, 60, 2), -        ] -    }, -    1: { -        coinsNeeded: 5, -        exit: { -            x: 40, -            y: 460, -            radius: 20 -        }, -        title: "Downwards Dash", -        items: [ -            constructVent(420, 580, 60, 600), -            constructCoin(40, 80), -            constructVent(120, 100, 280, 100), -            constructBlock(580, 200, 10, 250), -            constructCoin(700, 240), -            constructCoin(700, 320), -            constructCoin(700, 400), -            constructRamp(70, 400, 200, 10, 2/5), -            constructRamp(70, 480, 200, 10, 2/5), -            constructCoin(170, 405), -            constructBlock(0, 0, 800, 40) -        ] +        title, coinsNeeded      } -}
\ No newline at end of file +} +var levels = {} +levels[1] = createLevel("Downwards Dash", 5, 40, 460) +levels[1].items.push( +    constructVent(420, 580, 60, 600), +    constructCoin(40, 80), +    constructVent(120, 100, 280, 100), +    constructBlock(580, 200, 10, 250), +    constructCoin(700, 240), +    constructCoin(700, 320), +    constructCoin(700, 400), +    constructRamp(70, 400, 200, 10, 2 / 5), +    constructRamp(70, 480, 200, 10, 2 / 5), +    constructCoin(170, 405), +) + +levels[2] = createLevel("Switch madness", 0, 40, 460) +levels[2].items.push( +    constructSwitch(120, 400, 60, 60, 3), +    constructRect(300, 400, 60, 60, 0), +    constructRect(400, 400, 60, 60, 1), +    constructRect(500, 400, 60, 60, 2), +)
\ No newline at end of file | 
