diff options
author | elioat <elioat@tilde.institute> | 2023-10-30 20:37:37 -0400 |
---|---|---|
committer | elioat <elioat@tilde.institute> | 2023-10-30 20:37:37 -0400 |
commit | 41925d7f28696eb9542e58a92beb775e1386fd73 (patch) | |
tree | c092538fd2d5413f9b42cb5f70243a3d470d9d70 /js/canvas | |
parent | 09b87ef45f1f40e4abe08c9cc7073a9f8232c4e9 (diff) | |
download | tour-41925d7f28696eb9542e58a92beb775e1386fd73.tar.gz |
*
Diffstat (limited to 'js/canvas')
-rw-r--r-- | js/canvas/game.js | 8 | ||||
-rw-r--r-- | js/canvas/index.html | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/js/canvas/game.js b/js/canvas/game.js index 56a2861..04519c8 100644 --- a/js/canvas/game.js +++ b/js/canvas/game.js @@ -3,7 +3,7 @@ const canvas = document.getElementById("gameCanvas"); canvas.width = 512; canvas.height = 512; const ctx = canvas.getContext("2d"); -ctx.fillStyle = "#e0f8cf"; +ctx.fillStyle = "#E0F8CF"; ctx.fillRect(0, 0, canvas.width, canvas.height); @@ -50,11 +50,11 @@ document.addEventListener("keydown", (event) => { break; case "KeyZ": case "KeyN": - player.color = "#65ff00"; + console.log('Action A'); break; case "KeyX": case "KeyM": - player.color = player.colorAlt; + console.log('Action B'); break; } }); @@ -81,7 +81,7 @@ function gameLoop() { } // draw - ctx.fillStyle = player.color; + // ctx.fillStyle = player.color; ctx.fillRect(player.x, player.y, player.width, player.height); ctx.drawImage(playerSprite, player.x, player.y, player.width, player.height); diff --git a/js/canvas/index.html b/js/canvas/index.html index 2d887fe..1889b53 100644 --- a/js/canvas/index.html +++ b/js/canvas/index.html @@ -10,10 +10,10 @@ background-color: darkgray; } #gameCanvas { - border: 1px solid black; + border: 4px solid #E6CDF7; margin: 0 auto; display: block; - background-color: #f0f0f0; + background-color: #E0F8CF; } </style> </head> |