乒乓javaScript移动板

时间:2018-10-02 09:51:11

标签: javascript css html5

我必须用HTML 5做一个Pong游戏。 我需要对paddle(pala)移动执行javaScript。 播放器1的拨片通过键W和S移动,播放器2的拨片通过滑块向上和向下滑动。

我有这个

HTML

<!DOCTYPE html>
<html>
<body>
<header>
<h1>Super Tenis</h1>
</header>
<div id="game">
<div id="marcador">
<span class="puntuacion">Jugador A :
<span id="puntuacionA">0</span></span>
<span class="puntuacion">Jugador B :
<span id="puntuacionB">0</span></span>
</div>
<div id="pista">
<div id="jugadorA" class="pala"></div>
<div id="jugadorB" class="pala"></div>
2
<div id="pelota" style="left: 80px; top: 100px;"></div>
<div id="linea"></div>
<svg width="400" height="100">
<rect width="400" height="100"
style="fill:#81d41a;stroke-width:7;stroke:#ddd"></rect>
</svg>
<svg width="400" height="100">
<rect width="400" height="100"
style="fill:#81d41a;stroke-width:7;stroke:#ddd"></rect>
</svg>
</div>
<div id="espectadores"></div>
</div>
<footer>
Esto es un ejemplo del juego Pong.
</footer>
</body>
</html>

0 个答案:

没有答案