JS高级---案例贪吃蛇,把封装的函数移动到js文件中

案例贪吃蛇,把封装的函数移动到js文件中


<!
DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>title</title> <style> .map { width: 800px; height: 600px; background-color: #CCC; position: relative; } </style> </head> <body> <!--画出地图,设置样式--> <div class="map"></div> <script src="food.js"></script> <script src="Snake.js"></script> <script src="Game.js"></script> <script> //初始化游戏对象 var gm = new Game(document.querySelector(".map")); //初始化游戏---开始游戏 gm.init(); </script> </body> </html>

猜你喜欢

转载自www.cnblogs.com/jane-panyiyun/p/12145406.html
今日推荐