Skip to content

Commit

Permalink
add downward & upward camera movement
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoecheza committed Nov 7, 2024
1 parent 680459b commit 3007409
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ const Shortcuts: React.FC<Props> = ({ canvas, onResetCamera, onZoomIn, onZoomOut
<span className="Key">A</span>
<span className="Key">S</span>
<span className="Key">D</span>
<span className="Key">Q</span>
<span className="Key">E</span>
</div>
</div>
<div className="Item">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,16 @@ export class CameraManager {
camera.keysUp = [Keys.KEY_W, Keys.KEY_UP]
camera.keysLeft = [Keys.KEY_A, Keys.KEY_LEFT]
camera.keysRight = [Keys.KEY_D, Keys.KEY_RIGHT]
camera.keysDownward = [Keys.KEY_Q]
camera.keysUpward = [Keys.KEY_E]

function isCameraMoving(): boolean {
for (const key of camera.keysDown) if (keyState[key]) return true
for (const key of camera.keysUp) if (keyState[key]) return true
for (const key of camera.keysLeft) if (keyState[key]) return true
for (const key of camera.keysRight) if (keyState[key]) return true
for (const key of camera.keysDownward) if (keyState[key]) return true
for (const key of camera.keysUpward) if (keyState[key]) return true
return false
}

Expand Down

0 comments on commit 3007409

Please sign in to comment.