generated from remarkablegames/kaboom-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
305f6ca
commit 1e5817e
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "password": "swordfish" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
` |