diff --git a/assets/css/style.css b/assets/css/style.css index 6ed8ddb..e46a86b 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -276,10 +276,10 @@ tr:nth-child(even) { } @keyframes glow { - 0% { box-shadow: 0 0 -28px 13px #ff0000; } - 40% { box-shadow: 0 0 15px 13px #ff0000; } - 60% { box-shadow: 0 0 15px 13px #ff0000; } - 100% { box-shadow: 0 0 -28px 13px #ff0000; } + 0% { box-shadow: 0 0 -28px 13px #00ff00; } + 40% { box-shadow: 0 0 15px 13px #00ff00; } + 60% { box-shadow: 0 0 15px 13px #00ff00; } + 100% { box-shadow: 0 0 -28px 13px #00ff00; } } .indicator { @@ -373,7 +373,7 @@ button:hover { border-left: white; margin-right: 2px; position: absolute; - top: -35px; + bottom: -28px; right: 0px; } diff --git a/assets/img/sprites/controls.ase b/assets/img/sprites/controls.ase new file mode 100644 index 0000000..1b95fa0 Binary files /dev/null and b/assets/img/sprites/controls.ase differ diff --git a/assets/img/thumbnails/[avistaz.to] Detective Chinatown 1900 2025 1080p NF WEB-DL DD+5.1 x264-HBO.torrent b/assets/img/thumbnails/[avistaz.to] Detective Chinatown 1900 2025 1080p NF WEB-DL DD+5.1 x264-HBO.torrent new file mode 100644 index 0000000..987d5da Binary files /dev/null and b/assets/img/thumbnails/[avistaz.to] Detective Chinatown 1900 2025 1080p NF WEB-DL DD+5.1 x264-HBO.torrent differ diff --git a/assets/js/app.js b/assets/js/app.js index d781d0c..e705ffc 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -159,8 +159,10 @@ function gameLoop() { document.removeEventListener("keydown", _listener); if (terminalMode) { terminal.getKeystroke(); - } else if (!dialogMode) { - this.getKeystroke(); + } else if (dialogMode) { + this.getKeystroke(ignoreEnter=true); + } else { + this.getKeystroke() } } diff --git a/assets/js/dialog.js b/assets/js/dialog.js index 29ef233..63ba4d5 100644 --- a/assets/js/dialog.js +++ b/assets/js/dialog.js @@ -5,12 +5,12 @@ class Dialog { this.controlsElem = document.getElementById('controls') this.currentDialogIndex = 0 - this.dialogOrder = ['intro', 'controls', 'resume'] + this.dialogOrder = ['resume'] this.dialogMap = { - 'intro': 'Hello! Welcome to my Interactive Portfolio!
Press ENTER to continue, or click the links below for quick access to my Resume & Projects.', + 'resume': 'Hello! Welcome to my Interactive Portfolio!

Controls:

ENTER: Close this Dialog, Interact with things on screen
Arrow Keys: Movement (WASD or VIM keys also work)

Walk over to my resume and click ENTER', 'controls': 'Use ARROW KEYS or WASD or VIM keys (HJKL) to move around.
Press the ENTER key to interact with what you see on the screen.

', - 'resume': 'Walk over to the DESK and click on my RESUME.
The RESUME is marked by the flashing red indicator light.

', + // 'resume': 'Walk over to the DESK and click on my RESUME.
The RESUME is marked by the flashing red indicator light.

', 'portfolio': 'Thanks for looking at my Resume!
Check out my PORTFOLIO by clicking on the BOOKSHELF.
', 'other': 'Now that you have looked through my Porfolio, go explore the rest of the site! Thanks for stopping by!' } diff --git a/assets/js/keystroke.js b/assets/js/keystroke.js index 39fe698..c691a25 100644 --- a/assets/js/keystroke.js +++ b/assets/js/keystroke.js @@ -1,4 +1,4 @@ -function getKeystroke() { +function getKeystroke(ignoreEnter=false) { _listener = function (event) { if ( ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"].indexOf( @@ -18,7 +18,9 @@ function getKeystroke() { player.move('right') } else if ( event.key === "Enter" && - !terminal.active + !terminal.active && + !dialogMode && + !ignoreEnter ) { onEnter(); } diff --git a/assets/js/pathfinder.js b/assets/js/pathfinder.js new file mode 100644 index 0000000..d421c66 --- /dev/null +++ b/assets/js/pathfinder.js @@ -0,0 +1,164 @@ +const timer = ms => new Promise(res => setTimeout(res, ms)) + +var cols = 8 +var rows = 8 + +let grid = new Array(cols); + +let openSet = []; +let closedSet = []; + +let start; +let end; +let path = []; + +function heuristic(position0, position1) { + let d1 = Math.abs(position1.x - position0.x); + let d2 = Math.abs(position1.y - position0.y); + + return d1 + d2; +} + + +function GridPoint(x, y) { + this.x = x; + this.y = y; + this.f = 0; + this.g = 0; + this.h = 0; + this.neighbors = []; + this.parent = undefined; + + + this.updateNeighbors = function(grid) { + let i = this.x; + let j = this.y; + var tmpNeighbor; + if (i < cols - 1) { + tmpNeighbor = grid[i + 1][j] + if (!player.isBoundary([tmpNeighbor.x, tmpNeighbor.y])) { + this.neighbors.push(tmpNeighbor); + } + } + if (i > 0) { + tmpNeighbor = grid[i - 1][j] + if (!player.isBoundary([tmpNeighbor.x, tmpNeighbor.y])) { + this.neighbors.push(tmpNeighbor); + } + } + if (j < rows - 1) { + tmpNeighbor = grid[i][j + 1] + if (!player.isBoundary([tmpNeighbor.x, tmpNeighbor.y])) { + this.neighbors.push(tmpNeighbor); + } + } + if (j > 0) { + tmpNeighbor = grid[i][j - 1] + if (!player.isBoundary([tmpNeighbor.x, tmpNeighbor.y])) { + this.neighbors.push(tmpNeighbor); + } + } + }; +} + + +function init(destX, destY) { + + for (let i = 0; i < cols; i++) { + grid[i] = new Array(rows); + } + + for (let i = 0; i < cols; i++) { + for (let j = 0; j < rows; j++) { + grid[i][j] = new GridPoint(i, j); + } + } + + for (let i = 0; i < cols; i++) { + for (let j = 0; j < rows; j++) { + grid[i][j].updateNeighbors(grid); + } + } + + start = grid[player.canvasX][player.canvasY]; + end = grid[destX][destY] + + openSet.push(start); + + console.log(grid); +} + + +function search(destX, destY) { + path = []; + init(destX, destY); + while (openSet.length > 0) { + + let lowestIndex = 0; + for (let i = 0; i < openSet.length; i++) { + if (openSet[i].f < openSet[lowestIndex].f) { + lowestIndex = i; + } + } + let current = openSet[lowestIndex]; + + if (current === end) { + let temp = current; + path.push(temp); + while (temp.parent) { + path.push(temp.parent); + temp = temp.parent; + } + + return path.reverse() + } + + + openSet.splice(lowestIndex, 1); + + closedSet.push(current); + + let neighbors = current.neighbors; + + for (let i = 0; i < neighbors.length; i++) { + let neighbor = neighbors[i]; + + if (!closedSet.includes(neighbor)) { + let possibleG = current.g + 1; + + if (!openSet.includes(neighbor)) { + openSet.push(neighbor); + } else if (possibleG >= neighbor.g) { + continue; + } + + neighbor.g = possibleG; + neighbor.h = heuristic(neighbor, end); + neighbor.f = neighbor.g + neighbor.h; + neighbor.parent = current; + } + } + } + + return []; +} + +async function pathfind(destX, destY) { + var newPath = search(destX, destY) + for (let i = 0; i < newPath.length; i++) { + if (newPath[i].x > player.canvasX) { + player.direction = 'right' + } else if (newPath[i].x < player.canvasX) { + player.direction = 'left' + } + + if (newPath[i].y > player.canvasY) { + player.direction = 'down' + } else if (newPath[i].y < player.canvasY) { + player.direction = 'up' + } + player.canvasX = newPath[i].x + player.canvasY = newPath[i].y + await timer(100) + } +} diff --git a/index.html b/index.html index 612084a..f9d6b81 100644 --- a/index.html +++ b/index.html @@ -21,6 +21,7 @@ + @@ -29,6 +30,18 @@

Dominic DiTaranto

Software Developer & Architect + +
+ + +
@@ -558,17 +571,6 @@
- -
- -