Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generates QR #364

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 37 additions & 16 deletions dist/index.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/module.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/module.js.map

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@
},
"dependencies": {
"ethers": "^5.7.0",
"msgpack-lite": "^0.1.26",
"node-base91": "^0.3.4",
"pako": "^2.1.0",
"qrcode": "^1.5.4",
"tone": "^15.0.4"
},
"devDependencies": {
Expand Down Expand Up @@ -111,6 +115,7 @@
"sindri": "^0.0.1-alpha.55",
"snarkjs": "0.7.3",
"solidity-coverage": "^0.8.6",
"stream-browserify": "^3.0.0",
"xmldom": "^0.6.0"
},
"resolutions": {
Expand Down
16 changes: 12 additions & 4 deletions src/anybody.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { bodyThemes } from './colors.js'
import { loadFonts } from './fonts.js'
import { Buttons } from './buttons.js'
import { Intro } from './intro.js'
import { Save } from './save.js'
import PAUSE_BODY_DATA from './pauseBodies'

const GAME_LENGTH_BY_LEVEL_INDEX = [30, 10, 20, 30, 40, 50]
Expand Down Expand Up @@ -39,6 +40,7 @@ export class Anybody extends EventEmitter {
Object.assign(this, Calculations)
Object.assign(this, Buttons)
Object.assign(this, Intro)
Object.assign(this, Save)

this.setOptions(options)

Expand Down Expand Up @@ -451,13 +453,15 @@ export class Anybody extends EventEmitter {
const stats = this.calculateStats()
timeTook = stats.timeTook
this.framesTook = stats.framesTook
this.emit('done', {
const data = {
level: this.level,
won,
ticks: this.frames - this.startingFrame,
timeTook,
framesTook: this.framesTook
})
}
this.p5e_done(data)
this.emit('done', data)
if (won) {
this.finish()
}
Expand Down Expand Up @@ -559,11 +563,13 @@ export class Anybody extends EventEmitter {
}

started() {
this.emit('started', {
const data = {
day: this.day,
level: this.level,
bodyInits: JSON.parse(JSON.stringify(this.bodyInits))
})
}
this.p5e_started(data)
this.emit('started', data)
}

processMissileInits(missiles) {
Expand Down Expand Up @@ -673,6 +679,7 @@ export class Anybody extends EventEmitter {
m.step = this.frames
return m
})
this.p5e_chunk(results)
this.emit('chunk', results)
this.bodyFinal = []
// this.setPause(false)
Expand Down Expand Up @@ -993,6 +1000,7 @@ export class Anybody extends EventEmitter {

if (this.missiles.length > 0) {
if (this.lastMissileCantBeUndone) {
this.p5e_undo()
this.emit('remove-last-missile')
this.lastMissileCantBeUndone = false
console.log('LASTMISSILECANTBEUNDONE = FALSE')
Expand Down
Loading