拳皇一款双人对战游戏,支持组合键技能
这是我学完vue没多久写的,但当时写的很烂,现在拿出来改了改
html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>FOK拳皇</title>
<link rel="stylesheet" href="css/main.css">
</head>
<body>
<div id="game" ref="game">
<img src="imgs/other/BG2.gif" class="BG">
<!-- 玩家1 -->
<div class="ShowInfoP1">
<progress :value="p1Config.HP" min="0" max="20000" class="HP"></progress>
<progress :value="p1Config.anger" min="0" max="100" class="anger"></progress>
<div class="name">player1</div>
<div class="tip">{{p1Config.tip}}</div>
</div>
<div class="player1" ref="player1" :style="{
bottom:p1Config.bottomY + 'px',
left:p1Config.leftX + 'px',
}">
<div class="mark" style="--color: rgb(0, 157, 255);">1</div>
<!-- 角色 -->
<img :style="{
transform:'rotateY(' + p1Config.RrotateY + 'deg)',
bottom: p1Config.nearB + 'px',
right:p1Config.nearR,
left:p1Config.nearL,
width:p1Config.width + 'px'
}" :src="p1Config.action">
<!-- 攻击判定 -->
<div class="attackJudge" ref="p1AJ" :style="{width:p1Config.attackR.width + 'px',
height:p1Config.attackR.height + 'px',
top:p1Config.attackR.top + 'px',
left:p1Config.attackR.left,
right:p1Config.attackR.right,
transition: 'left ' + p1Config.attackR.transition + 's linear, ' + 'right ' + p1Config.attackR.transition + 's linear',
}">
</div>
</div>
<!-- 玩家2 -->
<div class="ShowInfoP2">
<progress :value="p2Config.HP" min="0" max="20000" class="HP"></progress>
<progress :value="p2Config.anger" min="0" max="100" class="anger"></progress>
<div class="name">player2</div>
<div class="tip">{{p2Config.tip}}</div>
</div>
<div class="player2" ref="player2" :style="{
bottom:p2Config.bottomY + 'px',
left:p2Config.leftX + 'px',
}">
<div class="mark" style="--color: rgb(255, 45, 45);">2</div>
<!-- 角色 -->
<img :style="{
transform:'rotateY(' + p2Config.RrotateY + 'deg)',
bottom: p2Config.nearB + 'px',
right:p2Config.nearR,
left:p2Config.nearL,
width:p2Config.width + 'px'
}" :src="p2Config.action">
<!-- 攻击判定 -->
<div class="attackJudge" ref="p2AJ" :style="{width:p2Config.attackR.width + 'px',
height:p2Config.attackR.height + 'px',
top:p2Config.attackR.top + 'px',
left:p2Config.attackR.left,
right:p2Config.attackR.right,
transition: 'left ' + p2Config.attackR.transition + 's linear, ' + 'right ' + p2Config.attackR.transition + 's linear',
}">
</div>
</div>
<div class="gameOver" v-show="gameOver">
<div class="ko">K.O</div>
<div class="restart" onclick="location.reload()">点击这里重新开始</div>
</div>
<!-- 地面 -->
<div class="ground" ref="ground"></div>
</div>
<script src="js/vue.js"></script>
<script src="js/main.js"></script>
</body>
</html>
css:
/* css */
JS:
// JS