Skip to content

Commit

Permalink
imported images for pong (currently broken)
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielFitzwilliam committed Dec 19, 2023
1 parent 795284e commit cd05331
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions _posts/2023-11-10-JS_Testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ blog: true
<h1>Canvas</h1>
<div>
<canvas id="window" width=500 height=300></canvas>
<script src="/student/js/canvas.js" type="module">
<script src="/Mario_OOP/js/canvas.js" type="module">
</script>
</div>
<div id="radios">
Expand All @@ -28,6 +28,6 @@ blog: true
</div>
<div id="button">
<input type="button" id="play" name="play" value="Play Game"><br>
<script src="/student/js/gameLoop.js" type="module">
<script src="/Mario_OOP/js/gameLoop.js" type="module">
</div>
</body>
4 changes: 2 additions & 2 deletions assets/js/pong/canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ const ctx = canvas.getContext("2d");
function drawBg() {
const image = new Image();
if (selectedValue === "Calvin") { //draws the image based on the radio button that is clicked.
image.src = "/student/images/Calvin.png";
image.src = "/Mario_OOP/images/dogs/Calvin.png";
}
else if (selectedValue === "Freckles") {
image.src = "/student/images/Freckles.png";
image.src = "/Mario_OOP/images/dogs/Freckles.png";
}

image.onload = function() {
Expand Down
Binary file added images/dogs/Calvin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/dogs/Freckles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cd05331

Please sign in to comment.