Skip to content

Commit

Permalink
feat(levels): add 23
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Jun 2, 2024
1 parent 305f6ca commit 1e5817e
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions public/data/password.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "password": "swordfish" }
43 changes: 43 additions & 0 deletions src/levels/23.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { password } from '../../public/data/password.json'
import {
addKey,
addPlayer,
addText,
loadExit,
registerPasswordCheck,
registerPlayerMovement,
registerWinCondition,
} from '../templates'

export const level = 23
export const title = 'fetch'
export const hint = 'Google JavaScript Fetch API'

export const prescript = `
${loadExit()}
${addPlayer({ pos: '100, 100' })}
${addKey({
pos: 'center()',
obj: JSON.stringify({ password }),
})}
${registerPlayerMovement()}
${registerWinCondition(level)}
${registerPasswordCheck(password)}
${addText('Fetch the password')}
`

export const script = `
/**
* fetch() makes a request for a resource
*/
const key = get('key')[0]
// GET the password from "/data/password.json"
let password
key.password = password
`

0 comments on commit 1e5817e

Please sign in to comment.