Skip to content

Commit

Permalink
build: deploy 3d18e00 to gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] committed Dec 18, 2024
0 parents commit 0f4fe60
Show file tree
Hide file tree
Showing 91 changed files with 1,198 additions and 0 deletions.
16 changes: 16 additions & 0 deletions assets/0-u21GzJUr.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import{a as o,b as e,r as s,c as t}from"./sprites-Bn2kHYEW.js";import"./index-Diikzz16.js";import{a as r}from"./texts-D4Uwcsjn.js";const n=0;const i="console.log";const d="Press the door";const p=`
${o({pos:"50, center().y"})}
${e({pos:"width() - 50, center().y"})}
${s()}
${t(n)}
${r("WASD or arrow keys to move")}
`;const m=`
/**
* console.log() outputs a message to the console
*/
// change the message below and press "Run"
console.log('Hello, World!')
`;export{d as hint,n as level,p as prescript,m as script,i as title};
15 changes: 15 additions & 0 deletions assets/1-Bi5MWczl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import{a as e,l as t,r as s,c as r}from"./sprites-Bn2kHYEW.js";import"./index-Diikzz16.js";import{a as i}from"./texts-D4Uwcsjn.js";const n=1;const m="Single-line Comments";const c="Delete the `//` and press Run";const p=`
${e({pos:"50, 100"})}
${t()}
${s()}
${r(n)}
${i("Uncomment the exit")}
`;const d=`
/**
* A single-line comment starts with 2 forward slashes
*/
// add([sprite('exit'), pos(center()), area(), 'exit'])
`;export{c as hint,n as level,p as prescript,d as script,m as title};
24 changes: 24 additions & 0 deletions assets/10-girRO-_x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import{a as e,b as t,d as o,c as n}from"./sprites-Bn2kHYEW.js";import"./index-Diikzz16.js";import{a}from"./texts-D4Uwcsjn.js";const s=10;const p="Function Expressions";const m="Use a negative number";const l=`
${e()}
${t({pos:"center().x, 550"})}
${o()}
${n(s)}
${a("Move me again")}
`;const d=`
/**
* A function expression can omit the function name
* to create an anonymous function
*/
const player = get('player')[0]
const movePlayer = function () {
player.move(0, 0)
}
player.onUpdate(() => movePlayer())
`;const y=`
get('player')[0]?.moveTo(width() - 50, 75)
`;export{m as hint,s as level,y as postscript,l as prescript,d as script,p as title};
46 changes: 46 additions & 0 deletions assets/11-C3XU9BtN.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import{a as t,b as e,d as o,c as i}from"./sprites-Bn2kHYEW.js";import"./index-Diikzz16.js";import{a as s}from"./texts-D4Uwcsjn.js";const n=11;const p="Function Hoisting";const d=`
${t()}
${e()}
${o()}
${i(n)}
${s("Move at the right time")}
`;const l=`
/**
* Hoisting is where function declarations are moved to
* the top of the scope before execution
*
* Note: hoisting does not apply to function expressions
*/
const player = get('player')[0]
player.onUpdate(() => movePlayer())
function movePlayer() {
player.move(velocityX, velocityY)
}
const velocityX = 0
const velocityY = 0
`;const y=`
get('player')[0]?.moveTo(40, 70)
const exit = get('exit')[0]
const x = 40
const y = 560
const duration = 3
if (exit) {
exit.moveTo(x, y)
addTween()
}
async function addTween() {
for (let i = 0; i < Number.MAX_SAFE_INTEGER; i++) {
await tween(exit.pos, vec2(width() - x, y), duration, (pos) => (exit.pos = pos))
await tween(exit.pos, vec2(x, y), duration, (pos) => (exit.pos = pos))
}
}
`;export{n as level,y as postscript,d as prescript,l as script,p as title};
24 changes: 24 additions & 0 deletions assets/12-B5XZ8AC0.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import{l as r,a as t,e as a,r as o,c as n,f as i}from"./sprites-Bn2kHYEW.js";import"./index-Diikzz16.js";import{a as d}from"./texts-D4Uwcsjn.js";const s=12;const g="Variables";const e=(new Date().getFullYear()+s)*31337;const w=String(e);const y=`
${r()}
${t({pos:"100, 100"})}
${a({pos:"center()",obj:JSON.stringify({password:e})})}
${o()}
${n(s)}
${i(e)}
${d("Update password & go to key")}
`;const m=`
/**
* A variable stores data
* 'const' cannot be reassigned, whereas 'let' can be reassigned
*/
const key = get('key')[0]
// password = (current_year + current_level_number) * 31337
let password
key.password = password
`;export{w as hint,s as level,y as prescript,m as script,g as title};
36 changes: 36 additions & 0 deletions assets/13-EDy9RWx7.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import{l as t,a as o,e as r,r as i,c as l,f as n}from"./sprites-Bn2kHYEW.js";import"./index-Diikzz16.js";import{a as c}from"./texts-D4Uwcsjn.js";const s=13;const $="Template Literals";const m='"hash": "${hash}"';const a=Array(10).fill(void 0).map(()=>"286755fad04869ca523320acce0dc6a4").join("");const e=`
{
"level": ${s},
"hash": "${a}"
}
`;const y=`
${t()}
${o({pos:"100, 100"})}
${r({pos:"center()",obj:JSON.stringify({password:e,hash:a})})}
${i()}
${l(s)}
${n(e)}
${c("Multiline password")}
`;const v=`
/**
* A template literal allows variables to be interpolated in a string
*/
const key = get('key')[0]
const level = ${s}
const hash = key.hash
// pass in hash
const password = \`
{
"level": \${level},
"hash": ""
}
\`
key.password = password
`;export{m as hint,s as level,y as prescript,v as script,$ as title};
23 changes: 23 additions & 0 deletions assets/14-BMMuCu1j.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import{l as r,a as e,e as o,r as a,c as t,f as p}from"./sprites-Bn2kHYEW.js";import"./index-Diikzz16.js";import{a as i}from"./texts-D4Uwcsjn.js";const n=14;const w="For Loop";const y="Array(42).fill().map(...).join('')";const s=Array.from(Array(42).keys()).map(()=>"answer").join("");const m=`
${r()}
${e({pos:"100, 100"})}
${o({pos:"center()",obj:JSON.stringify({password:s})})}
${a()}
${t(n)}
${p(s)}
${i("Repeat the password")}
`;const f=`
/**
* A for loop repeats a block of code
*/
const key = get('key')[0]
// password = 'answer' repeated 42 times
let password = 'answer' + 'answer'
key.password = password
`;export{y as hint,n as level,m as prescript,f as script,w as title};
74 changes: 74 additions & 0 deletions assets/15-D5wXN5az.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import{g as t,h as s,a as i,b as r,r as p,c as a}from"./sprites-Bn2kHYEW.js";import"./index-Diikzz16.js";import{a as n}from"./texts-D4Uwcsjn.js";const c=15;const m="forEach";const o=`
const map = [
' ',
' ',
'^^^^^ ^^^',
' ',
'^ ^^^^ ',
'^ ^^^',
' ^ ',
'^^^^ ^^^ ',
]
`;const e=o.split("^").length-1;const h=`There are ${e} spikes`;const k=`
${t()}
${s()}
${i()}
${r()}
${p()}
${a(c)}
${o}
const TILE_SIZE = 64
map.forEach((row, rowIndex) => {
row.split('').forEach((column, columnIndex) => {
if (column === '^') {
add([
sprite('spike'),
area(),
pos(TILE_SIZE * columnIndex, TILE_SIZE * rowIndex),
opacity(0),
'spike',
])
}
})
})
onCollide('player', 'spike', (player, spike) => {
play('hit')
spike.opacity = 1
player.destroy()
addKaboom(player.pos)
})
onUpdate(() => {
const player = get('player')[0]
if (!player) {
return
}
const { x, y } = player.pos
if (x < 0 || y < 0 || x > width() || y > height()) {
player.moveTo(40, 80)
}
if (get('spike').length < ${e}) {
throw new Error('There must be ' + ${e} + ' spikes!')
}
})
${n("Invisible spikes")}
`;const f=`
/**
* forEach() is an iterative method
*/
const spikes = get('spike')
const firstSpike = spikes[0]
firstSpike.opacity = 1
`;const E=`
get('exit')[0]?.moveTo(550, 550)
get('player')[0]?.moveTo(50, 70)
`;export{h as hint,c as level,E as postscript,k as prescript,f as script,m as title};
76 changes: 76 additions & 0 deletions assets/16-BPFKB7pP.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import{i as e,j as o,g as t,a,b as n,r,c as s}from"./sprites-Bn2kHYEW.js";import"./index-Diikzz16.js";import{a as d}from"./texts-D4Uwcsjn.js";const c=16;const p="Loops";const m="Use for loops to add blocks around enemy";const E=`
${e()}
${o()}
${t()}
${a()}
${n()}
${r()}
${s(c)}
const ENEMY_SPEED = 500
let cancelEnemyUpdate;
function addEnemy() {
const enemy = add([
sprite('enemy'),
pos(center()),
area(),
body(),
'enemy',
])
cancelEnemyUpdate = enemy.onUpdate(() => {
const player = get('player')[0]
if (player) {
const dir = player.pos.sub(enemy.pos).unit()
enemy.move(dir.scale(ENEMY_SPEED))
}
}).cancel
return enemy
}
addEnemy()
onCollide('player', 'enemy', (player, enemy) => {
if (typeof cancelEnemyUpdate === 'function') {
cancelEnemyUpdate()
}
play('hit')
player.destroy()
addKaboom(player.pos)
})
onDestroy('enemy', () => {
addEnemy()
})
${d("Block yourself")}
`;const b=`
/**
* Can you build a fortress to block the enemy?
*/
const block = {
width: 64,
height: 64,
}
function addBlock(x, y) {
add([
sprite('block'),
pos(x, y),
area(),
body({ isStatic: true }),
])
}
addBlock(block.width * 3, block.height * 3)
`;const f=`
get('enemy')[0]?.moveTo(center())
get('exit')[0]?.moveTo(550, 550)
get('player')[0]?.moveTo(50, 70)
`;export{m as hint,c as level,f as postscript,E as prescript,b as script,p as title};
21 changes: 21 additions & 0 deletions assets/17-IdHGWz7T.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import{l as t,a as e,r as o,c as s}from"./sprites-Bn2kHYEW.js";import"./index-Diikzz16.js";import{a as i}from"./texts-D4Uwcsjn.js";const r=17;const m="setTimeout";const d="2nd argument of setTimeout() is delay in ms";const p=`
${t()}
${e({pos:"center()"})}
${o()}
${s(r)}
${i("How to not wait?")}
`;const l=`
/**
* setTimeout() executes a function once the timer expires
*/
const MILLISECOND = 1
const SECOND = MILLISECOND * 1000
const MINUTE = SECOND * 60
setTimeout(() => {
add([sprite('exit'), area(), 'exit'])
}, 5 * MINUTE)
`;export{d as hint,r as level,p as prescript,l as script,m as title};
25 changes: 25 additions & 0 deletions assets/18-DFccQC-4.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import{a as t,b as e,r as i,c as s}from"./sprites-Bn2kHYEW.js";import"./index-Diikzz16.js";import{a as n}from"./texts-D4Uwcsjn.js";const o=18;const d="setInterval";const l="2nd argument of setInterval() is delay in ms";const p=`
${t({pos:"center()"})}
${e()}
${i(50)}
${s(o)}
${n("Exit in a loop")}
`;const m=`
/**
* setInterval() calls a function at specified periods
*/
const MILLISECOND = 1
const SECOND = MILLISECOND * 1000
const exit = get('exit')[0]
setInterval(() => {
exit.moveTo(
randi(width()),
randi(height()),
)
}, 2 * SECOND)
`;export{l as hint,o as level,p as prescript,m as script,d as title};
Loading

0 comments on commit 0f4fe60

Please sign in to comment.