In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to use 63 lines of code to achieve the gluttonous Snake game in html5. The article is very detailed and has a certain reference value. Interested friends must read it!
The code is as follows:
Var c=document.getElementById ("myCanvas"); var time = 160,160; / Snake Speed var cxt=c.getContext ("2d"); var x = y = 8 interval var a = 0; / / Food coordinates var t = 20; / / body length var map = []; / / record snake running path var size = 8; / / Snake body unit size var direction = 2; / / 1 upward 2 to right 0 left 3 down interval = window.setInterval (set_game_speed, time) / / Mobile snake function set_game_speed () {/ / Mobile snake switch (direction) {case 1vex = y case sizescapebreakcase 2burex = xMusizescapebreakCase 0Wholx = xMusizescaptCase 3ZX;} if (x > 400 | | y > 400 | | x
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.