javascript贪吃蛇 (附带百度网盘链接)

这里贪吃蛇游戏是通过javascript面向对象编程的方法编写,代码结构分为游戏类(Game.js),

蛇行为类(Snake.js),食物类(Food.js),话不多说,直接源码了。(粘贴源码,引入正确路径即可运行)

贪吃蛇:链接:https://pan.baidu.com/s/1_gfxQOWZ5ktZXLARzcn6fA 
提取码:672a
其他游戏源码:俄罗斯方块https://blog.csdn.net/weixin_45851686/article/details/120242677https://blog.csdn.net/weixin_45851686/article/details/120242677

游戏页面:

目录

1.html&css页面搭建:

index.html:

2.游戏类 Game.js:

3.蛇类 Snake.js

4.食物类 food.js


1.html&css页面搭建:

index.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>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        #app {
            position: relative;
        }
        table {
            border-collapse: collapse;
         
            margin: auto;
        }

        td {
            width: 25px;
            height: 25px;
            border: 1px solid #aaa;
        }
        .fen {
            position: relative;
            width: 300px;
            height: 100px;
            margin: 0 auto 10px;
            background-color: #ccc;
            font-size: 14px;

        }
        p {
            display: block;
            width:
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值