foreach fail

This commit is contained in:
ntr 2018-11-20 00:31:59 +11:00
parent 552639809f
commit 9327b4381c
4 changed files with 8 additions and 8 deletions

View File

@ -4,8 +4,7 @@
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"start": "parcel index.html --port 40080 --no-hmr", "start": "parcel index.html --port 40080 --no-hmr --no-source-maps",
"start-lite": "parcel index.html --port 40080 --no-hmr --no-source-maps",
"build": "rm -rf dist && parcel build index.html", "build": "rm -rf dist && parcel build index.html",
"lint": "eslint --fix --ext .jsx src/", "lint": "eslint --fix --ext .jsx src/",
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"

View File

@ -22,10 +22,9 @@ class CrypList extends Phaser.Scene {
} }
redraw() { redraw() {
this.children.list.forEach(t => { for (let i = this.children.list.length - 1; i >= 0; i--) {
t.disableInteractive(); this.children.list[i].destroy();
t.destroy(); }
});
} }
renderCryps(cryps) { renderCryps(cryps) {

View File

@ -35,7 +35,9 @@ class CrypPage extends Phaser.Scene {
} }
redraw() { redraw() {
this.children.list.forEach(t => t.destroy()); for (let i = this.children.list.length - 1; i >= 0; i--) {
this.children.list[i].destroy();
}
} }
renderCryp(cryp) { renderCryp(cryp) {

View File

@ -8,7 +8,7 @@ const TOP_MARGIN = 50;
const ROW_MARGIN = 50; const ROW_MARGIN = 50;
const TEXT_MARGIN = 24; const TEXT_MARGIN = 24;
const xPos = i => Math.random() * 1400; const xPos = i => 0;
const yPos = i => (i * ROW_HEIGHT + ROW_MARGIN) + TOP_MARGIN; const yPos = i => (i * ROW_HEIGHT + ROW_MARGIN) + TOP_MARGIN;
function crypRow(list, cryp, i) { function crypRow(list, cryp, i) {