diff --git a/index.html b/index.html index 6c44ea0..f0e92b8 100644 --- a/index.html +++ b/index.html @@ -21,11 +21,18 @@ your experience.

+<<<<<<< HEAD + +=======
Time

+>>>>>>> 380cebd36dc4e3a1f3af185d1a7e3f0adb3e04d1
diff --git a/modules/fillLevelsSelection.mjs b/modules/fillLevelsSelection.mjs new file mode 100644 index 0000000..bea2119 --- /dev/null +++ b/modules/fillLevelsSelection.mjs @@ -0,0 +1,11 @@ +import { levelsBlueprint } from '/modules/levels.mjs' + +export const fillLevelSelection = () => { + let levelList = document.getElementById('level-list'); + for (let i = 0; i < levelsBlueprint.size; ++i) { + let listElement = document.createElement("li"); + let selectionButton = document.createElement("button"); + selectionButton.setAttribute("array-index", index); + // selectionButton.addEventListener + } +} diff --git a/modules/levels.mjs b/modules/levels.mjs index 55cc026..1ee70ae 100644 --- a/modules/levels.mjs +++ b/modules/levels.mjs @@ -1,12 +1,18 @@ import { Square } from '/modules/enums.mjs'; // Blueprint for the first level -export const level1Blueprint = [[ Square.Wall, Square.Wall, Square.Wall, Square.Wall, Square.Wall, Square.Wall ], +// +const level1Blueprint = [[ Square.Wall, Square.Wall, Square.Wall, Square.Wall, Square.Wall, Square.Wall ], [ Square.Wall, Square.Destination, Square.Box, Square.Floor, Square.Player, Square.Wall ], [ Square.Wall, Square.Wall, Square.Wall, Square.Wall, Square.Wall, Square.Wall ]]; +<<<<<<< HEAD + +const level2Blueprint = [ +======= // Blueprint for the second level export const level2Blueprint = [ +>>>>>>> 380cebd36dc4e3a1f3af185d1a7e3f0adb3e04d1 [Square.Wall, Square.Wall, Square.Wall, Square.Wall, Square.Wall, Square.Wall, Square.Wall, Square.Wall, Square.Wall, Square.Wall, Square.Wall, Square.Wall, Square.Floor, Square.Floor ], [Square.Wall, Square.Destination, Square.Destination, Square.Floor, Square.Floor, Square.Wall, Square.Floor, Square.Floor, Square.Floor, Square.Floor, Square.Floor, Square.Wall, Square.Wall, Square.Wall], [Square.Wall, Square.Destination, Square.Destination, Square.Floor, Square.Floor, Square.Wall, Square.Floor, Square.Box, Square.Floor, Square.Floor, Square.Box, Square.Floor, Square.Floor, Square.Wall], @@ -18,3 +24,8 @@ export const level2Blueprint = [ [Square.Floor, Square.Floor, Square.Wall, Square.Floor, Square.Floor, Square.Floor, Square.Floor, Square.Wall, Square.Floor, Square.Floor, Square.Floor, Square.Floor, Square.Floor, Square.Wall ], [Square.Floor, Square.Floor, Square.Wall, Square.Wall, Square.Wall, Square.Wall, Square.Wall, Square.Wall, Square.Wall, Square.Wall, Square.Wall, Square.Wall, Square.Wall, Square.Wall ], ]; + +export const levelsBlueprint = [ + level1Blueprint, + level2Blueprint, +] diff --git a/notes_implementation.md b/notes_implementation.md new file mode 100644 index 0000000..bf1e1af --- /dev/null +++ b/notes_implementation.md @@ -0,0 +1,20 @@ +# Implementation + +```js + +enum BackgroundTile {Wall, Floor, Destination}; +enum ForegroundTile {Player, Box, Empty}; + +let playground = { + background: { + tiles: [[]] + }, + foreground: { + tiles: [[]] + }, + move(sourcePos, destPos) { + if (this.move(destPos, )) + } +}; +``` + diff --git a/script.js b/script.js index 8a2521e..e45a631 100644 --- a/script.js +++ b/script.js @@ -1,11 +1,17 @@ import { generatePlayground } from '/modules/playground.mjs' -import { level1Blueprint, level2Blueprint } from '/modules/levels.mjs' +import {levelsBlueprint } from '/modules/levels.mjs' import { MoveDirection } from '/modules/enums.mjs' +import { fillLevelsSelection } from '/modules/fillLevelsSelection.mjs' +fillLevelSelection(); let canvas = document.getElementById('canvas'); let ctx = canvas.getContext('2d'); window.ctx = ctx +<<<<<<< HEAD +let playground = generatePlayground(levelsBlueprint[0], canvas.width, canvas.height); +======= let playground = generatePlayground(level2Blueprint, canvas.width, canvas.height); +>>>>>>> 380cebd36dc4e3a1f3af185d1a7e3f0adb3e04d1 window.addEventListener("keydown", (event) => { if (!event.defaultPrevented) { switch (event.key) { diff --git a/style.css b/style.css index 56ba717..62933a2 100644 --- a/style.css +++ b/style.css @@ -7,6 +7,7 @@ body { background-color: var(--main-background-color); display: flex; + color: --main-invert-color; } .dialog {