Skip to content

Commit

Permalink
feat(levels): add level 1
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed May 26, 2024
1 parent fead829 commit 6b26943
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/levels/0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ export function prescript() {
add([sprite(Sprite.exit), pos(500, 500), area(), Sprite.exit])

onCollide(Sprite.player, Sprite.exit, () => {
go(Scene.game, level)
go(Scene.game, level + 1)
})
}

export const script = `
add([
text('WASD or arrow keys to move', { width: 600 })
text('WASD or arrow keys to move')
])
`

Expand Down
30 changes: 30 additions & 0 deletions src/levels/1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { addCursorKeys } from '../helpers'
import { Scene, Sprite } from '../types'

export const level = 1
export const title = 'Comments'

export function prescript() {
loadSprite(Sprite.player, 'sprites/bean.png')
loadSprite(Sprite.exit, 'sprites/door.png')

addCursorKeys(
add([sprite(Sprite.player), pos(50, 50), area(), Sprite.player]),
)

onCollide(Sprite.player, Sprite.exit, () => {
go(Scene.game, 0)
})

add([text("Where's the exit?")])
}

export const script = `
/**
* Single line comments start with two forward slashes //
*/
// add([sprite('exit'), pos(center()), area(), 'exit'])
`

export function postscript() {}

0 comments on commit 6b26943

Please sign in to comment.