Skip to content

Commit

Permalink
fix(levels): improve hints and incorrect password message
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Jun 11, 2024
1 parent d9ad8a4 commit 4b60b12
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/levels/0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {

export const level = 0
export const title = 'console.log'
export const hint = 'Reach the exit'
export const hint = 'Press the door'

export const prescript = `
${addPlayer({ pos: '50, center().y' })}
Expand Down
2 changes: 2 additions & 0 deletions src/levels/10.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export const title = 'Variables'

const password = (new Date().getFullYear() + level) * 31337

export const hint = String(password)

export const prescript = `
${loadExit()}
Expand Down
1 change: 1 addition & 0 deletions src/levels/11.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {

export const level = 11
export const title = 'For Loop'
export const hint = "Array(42).fill().map(...).join('')"

const password = Array.from(Array(42).keys())
.map(() => 'answer')
Expand Down
12 changes: 10 additions & 2 deletions src/templates/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,22 @@ ${loadBlip()}
${loadPowerup()}
onCollide('key', 'player', (key) => {
if (key.password === ${JSON.stringify(password)}) {
const password = ${JSON.stringify(password)}
if (key.password === password) {
play('powerup', { volume: 0.5 })
key.destroy()
add([sprite('exit'), pos(500, 500), area(), 'exit'])
return
}
if (typeof key.password !== typeof password) {
debug.log('Password should be a ' + typeof password)
} else {
play('blip', { volume: 0.5 })
debug.log('Incorrect password')
}
play('blip', { volume: 0.5 })
})
`

Expand Down

0 comments on commit 4b60b12

Please sign in to comment.