我是 javascript 新手,但由于某种原因我有这个错误 GET http://127.0.0.1:5500/src/paddle net::ERR_ABORTED 404 (Not Found) 我的代码看起来像这样 index.html
<html>
<head>
<title >Game</title>
<meta charset="UTF-8" />
<style>
#gameScreen {
border: 1px solid black;
}
</style>
</head>
<body>
<canvas id="gameScreen" width="800" height="600"></canvas>
<script type="module" src="src/index.js"></script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
索引.js
import Paddle from "/src/paddle";
let canvas = document.getElementById("gameScreen");
let ctx = canvas.getContext('2d');
const GAME_WIDTH = 800;
const GAME_HEIGHT = 800;
let paddle = new Paddle(GAME_WIDTH, GAME_HEIGHT);
paddle.draw(ctx);
Run Code Online (Sandbox Code Playgroud)
桨.js
export default class Paddle {
constructor(gameWidth, gameHeight) {
this.width = 150;
this.height = …Run Code Online (Sandbox Code Playgroud)