diff --git a/src/levels/0.ts b/src/levels/0.ts index 21d4cae..9eae7e1 100644 --- a/src/levels/0.ts +++ b/src/levels/0.ts @@ -9,8 +9,8 @@ export const level = 0 export const title = 'Hello, World!' export const prescript = ` -${loadPlayer} -${loadExit} +${loadPlayer()} +${loadExit()} const player = add([sprite('player'), pos(50, 50), area(), 'player']) diff --git a/src/levels/1.ts b/src/levels/1.ts index 987cea8..8d304b2 100644 --- a/src/levels/1.ts +++ b/src/levels/1.ts @@ -9,8 +9,8 @@ export const level = 1 export const title = 'Comments' export const prescript = ` -${loadPlayer} -${loadExit} +${loadPlayer()} +${loadExit()} const player = add([sprite('player'), pos(50, 50), area(), 'player']) diff --git a/src/levels/10.ts b/src/levels/10.ts index 337def7..de48a6a 100644 --- a/src/levels/10.ts +++ b/src/levels/10.ts @@ -9,8 +9,8 @@ export const level = 10 export const title = 'forEach' export const prescript = ` -${loadPlayer} -${loadExit} +${loadPlayer()} +${loadExit()} loadSprite('spike', 'sprites/spike.png') const player = add([ diff --git a/src/levels/11.ts b/src/levels/11.ts index f9303d9..ef2f106 100644 --- a/src/levels/11.ts +++ b/src/levels/11.ts @@ -9,8 +9,8 @@ export const level = 11 export const title = 'Loops' export const prescript = ` -${loadPlayer} -${loadExit} +${loadPlayer()} +${loadExit()} loadSprite('enemy', 'sprites/ghosty.png') loadSprite('wall', 'sprites/steel.png') diff --git a/src/levels/12.ts b/src/levels/12.ts index 3ff2aed..672616d 100644 --- a/src/levels/12.ts +++ b/src/levels/12.ts @@ -9,8 +9,8 @@ export const level = 12 export const title = 'setTimeout' export const prescript = ` -${loadPlayer} -${loadExit} +${loadPlayer()} +${loadExit()} const player = add([sprite('player'), pos(50, 50), area(), 'player']) diff --git a/src/levels/13.ts b/src/levels/13.ts index fc8428e..436a502 100644 --- a/src/levels/13.ts +++ b/src/levels/13.ts @@ -9,8 +9,8 @@ export const level = 13 export const title = 'setInterval' export const prescript = ` -${loadPlayer} -${loadExit} +${loadPlayer()} +${loadExit()} const player = add([sprite('player'), pos(50, 80), area(), anchor('center'), 'player']) diff --git a/src/levels/14.ts b/src/levels/14.ts index 51c9a2f..9cbba53 100644 --- a/src/levels/14.ts +++ b/src/levels/14.ts @@ -9,8 +9,8 @@ export const level = 14 export const title = 'Timer' export const prescript = ` -${loadPlayer} -${loadExit} +${loadPlayer()} +${loadExit()} loadSprite('key', 'sprites/key.png') const player = add([sprite('player'), pos(center()), area(), 'player']) diff --git a/src/levels/15.ts b/src/levels/15.ts index a91c42b..33c2be8 100644 --- a/src/levels/15.ts +++ b/src/levels/15.ts @@ -11,8 +11,8 @@ export const title = 'JSON.stringify' const password = JSON.stringify({ level, year: new Date().getFullYear() }) export const prescript = ` -${loadPlayer} -${loadExit} +${loadPlayer()} +${loadExit()} loadSprite('key', 'sprites/key.png') const player = add([sprite('player'), pos(100, 100), area(), 'player']) diff --git a/src/levels/2.ts b/src/levels/2.ts index 8e75471..56e9099 100644 --- a/src/levels/2.ts +++ b/src/levels/2.ts @@ -9,8 +9,8 @@ export const level = 2 export const title = 'Strings' export const prescript = ` -${loadPlayer} -${loadExit} +${loadPlayer()} +${loadExit()} const player = add([sprite('player'), pos(center()), area(), 'player']) diff --git a/src/levels/3.ts b/src/levels/3.ts index 0b59d77..98ec752 100644 --- a/src/levels/3.ts +++ b/src/levels/3.ts @@ -9,8 +9,8 @@ export const level = 3 export const title = 'Numbers' export const prescript = ` -${loadPlayer} -${loadExit} +${loadPlayer()} +${loadExit()} const player = add([sprite('player'), pos(500, 500), area(), 'player']) diff --git a/src/levels/4.ts b/src/levels/4.ts index 40925f3..27defe7 100644 --- a/src/levels/4.ts +++ b/src/levels/4.ts @@ -9,8 +9,8 @@ export const level = 4 export const title = 'Booleans' export const prescript = ` -${loadPlayer} -${loadExit} +${loadPlayer()} +${loadExit()} const player = add([sprite('player'), pos(center()), area(), 'player']) diff --git a/src/levels/5.ts b/src/levels/5.ts index 51808b2..bda942d 100644 --- a/src/levels/5.ts +++ b/src/levels/5.ts @@ -9,9 +9,9 @@ export const level = 5 export const title = 'Arrays' export const prescript = ` -${loadPlayer} +${loadPlayer()} loadSprite('wall', 'sprites/steel.png') -${loadExit} +${loadExit()} const player = add([sprite('player'), pos(center()), area(), body(), 'player']) add([sprite('exit'), pos(500, 500), area(), 'exit']) diff --git a/src/levels/6.ts b/src/levels/6.ts index 2610b7d..e72f471 100644 --- a/src/levels/6.ts +++ b/src/levels/6.ts @@ -4,8 +4,8 @@ export const level = 6 export const title = 'Objects' export const prescript = ` -${loadPlayer} -${loadExit} +${loadPlayer()} +${loadExit()} const player = add([sprite('player'), pos(0, 36), area(), body(), 'player']) add([sprite('exit'), pos(516, 516), area(), 'exit']) diff --git a/src/levels/7.ts b/src/levels/7.ts index e73b1f2..171e8ee 100644 --- a/src/levels/7.ts +++ b/src/levels/7.ts @@ -4,8 +4,8 @@ export const level = 7 export const title = 'Functions' export const prescript = ` -${loadPlayer} -${loadExit} +${loadPlayer()} +${loadExit()} add([sprite('player'), pos(0, 36), area(), 'player']) add([sprite('exit'), pos(center().x, 500), area(), 'exit']) diff --git a/src/levels/8.ts b/src/levels/8.ts index b9fe3a4..48c4a1e 100644 --- a/src/levels/8.ts +++ b/src/levels/8.ts @@ -11,8 +11,8 @@ export const title = 'Variables' const password = (new Date().getFullYear() + level) * 31337 export const prescript = ` -${loadPlayer} -${loadExit} +${loadPlayer()} +${loadExit()} loadSprite('key', 'sprites/key.png') const player = add([sprite('player'), pos(100, 100), area(), 'player']) diff --git a/src/levels/9.ts b/src/levels/9.ts index 058c2fc..cb717e2 100644 --- a/src/levels/9.ts +++ b/src/levels/9.ts @@ -13,8 +13,8 @@ const password = Array.from(Array(42).keys()) .join('') export const prescript = ` -${loadPlayer} -${loadExit} +${loadPlayer()} +${loadExit()} loadSprite('key', 'sprites/key.png') const player = add([sprite('player'), pos(100, 100), area(), 'player']) diff --git a/src/templates/layouts.ts b/src/templates/layouts.ts index 05252cf..a53ed01 100644 --- a/src/templates/layouts.ts +++ b/src/templates/layouts.ts @@ -1,5 +1,4 @@ -export function wrapGame(code: string) { - return ` +export const wrapGame = (code: string) => ` @@ -37,4 +36,3 @@ ${code} ` -} diff --git a/src/templates/sprites.ts b/src/templates/sprites.ts index e5e7d80..719076e 100644 --- a/src/templates/sprites.ts +++ b/src/templates/sprites.ts @@ -1,3 +1,3 @@ -export const loadExit = `loadSprite('exit', 'sprites/door.png')` +export const loadExit = () => `loadSprite('exit', 'sprites/door.png')` -export const loadPlayer = `loadSprite('player', 'sprites/bean.png')` +export const loadPlayer = () => `loadSprite('player', 'sprites/bean.png')`