纯前端小游戏
这个小游戏已经被我挂载到了我的网站 http://www.xiaoneko.site/shootboat.html 大家可以试玩,素材附在了代码后面 具体的实现比较简单 大家可以鉴赏一下 纯属娱乐,有一种扫雷游戏的意思通过js实现简单的图片更换,以达到游戏效果
大家如果有什么对于网站有想要借鉴的地方也都可以找我
我是用php写的
<!DOCTYPE html>
<html lang='en'>
<style>
.normal{
float:left;width:50px;height:50px;text-align: center;}
.map{
margin:0 auto;text-align:center;height:250px;width:200px;}
.row{
float:center;height:50px;width:200px;}
.block{
height:100px;}
</style>
<head>
<meta charset="UTF-8">
<script type="text/javascript">
function $(id){
return document.getElementById(id);}
function randomit()
{
return Math.floor((Math.random()*19));
}
var point= new Array(20).fill(0);
var click= new Array(20).fill(1);
function makepoint()
{
var ship3=randomit();
var ship4=randomit();
if((ship3<ship4&&(ship4-ship3)>=3)||(ship3>ship4&&(ship3-ship4)>=4))
{
if((ship3<=17)&&(ship4<=16))
{
point[ship3]=1;point[ship3+1]=1;point[ship3+2]=1;
point[ship4]=1;point[ship4+1]=1;point[ship4+2