Build Your Own Platformer Game: HTML Code and Tutorial
<!DOCTYPE html>
<html>
<head>
<title>Platformer Game</title>
<style type="text/css">
#game-board {
width: 500px;
height: 500px;
background-color: #ccc;
position: relative;
}
.platform {
background-color: #000;
width: 50px;
height: 10px;
position: absolute;
}
.player {
background-color: #f00;
width: 20px;
height: 20px;
position: absolute;
}
</style>
</head>
<body>
<div id="game-board">
<div class="platform" style="top: 40px; left: 100px;"></div>
<div class="platform" style="top: 100px; left: 200px;"></div>
<div class="platform" style="top: 200px; left: 300px;"></div>
<div class="player" style="top: 10px; left: 10px;"></div>
</div>
<script type="text/javascript">
// Code for game goes here
</script>
</body>
</html>
原文地址: https://www.cveoy.top/t/topic/lnRP 著作权归作者所有。请勿转载和采集!