Home > front end >  HTML question
HTML question

Time:09-24


This is a lightning source code, find online, but part of js no matter together or apart, useless, what is this excuse me?










Lightning beibei version & lt;/title> <br/><script> <br/><br/>//start game <br/>The function start () {<br/>//alert (" start "); <br/>FighterMove ();//call fighter move way <br/>//fireBullet ();//call the fire Bullet way <br/>EnemyMove ();//call the enemy move way <br/>BackgroundMove ();//call background loop moving way <br/>Timer=setInterval (fireBullet "()", 100); <br/>Timers=setInterval (enemyFiredBullet "()", 2000); <br/><br/>} <br/><br/>//background loop moving <br/>j=0; <br/>The function backgroundMove () {<br/>//alert (" backgroundMove "); <br/>j++; <br/>Interface. Style. BackgroundPosition="0" + j; <br/>SetTimeout (backgroundMove "()", 16); <br/><br/>} <br/><br/>//control fighter move <br/>The function fighterMove () {<br/>//alert (" fighterMove "); <br/>Document. The onkeydown=keydown; <br/>The function keydown (e) {<br/>Var keyName=String. FromCharCode (e.w hich); <br/>//alert (keyName); <br/>//turn up <br/>If (keyName=="& amp;" & & ParseInt (fighter. Style. Top) & gt; 50) {<br/>//alert (" up "); <br/>Top -=10; <br/>Fighter. Style. The top=parseInt (fighter. Style. Top) - 10; <br/>} <br/>//turn down <br/>If (keyName=="(" & amp; & ParseInt (fighter. Style. Top) & lt; 470) {<br/>//alert (" down "); <br/>Top +=10; <br/>Fighter. Style. The top=parseInt (fighter. Style. Top) + 10; <br/>} <br/>//turn left <br/>If (keyName=="%" & amp; & The parseInt (fighter. Style. Left) & gt; 10) {<br/>//alert (" left "); <br/>Left -=10; <br/>Fighter. Style. Left=parseInt (fighter. Style. Left) - 10; <br/>} <br/>//turn right <br/>If (keyName=="'" & amp; & The parseInt (fighter. Style. Left) & lt; 360) {<br/>//alert (" right "); <br/>Left +=10; <br/>Fighter. Style. Left=parseInt (fighter. Style. Left) + 10; <br/>} <br/>//the fighter fire bullet <br/>//if (keyName=="A") {<br/>//alert (" bulletFire "); <br/>//fireBullet (); <br/>//} <br/>} <br/>} <br/><br/>//the fire bullet <br/>Var top="440"; <br/>Var left="220"; <br/>The function fireBullet () {<br/>Var bullets; <br/>//alert (" fireBullet "); <br/>CreateBullet (); <br/>//create bullet <br/>The function createBullet () {<br/>Bullets=document. The createElement method (" div "); <br/>Bullets. Style. The width="5 px"; <br/>Bullets. Style. Height="5 px"; <br/>Bullets. Style. Background="red"; <br/>//alert (" ok "); <br/>Bullets. Style. The position="absolute"; <br/>Bullets. Style. The top=top; <br/>Bullets. Style. Left=left; <br/>Document. The body. The appendChild (bullets); <br/>//alert (document. The body. The appendChild (bullets)); <br/>} <br/>Time=setInterval (function () {<br/>//alert (" time "); <br/>Bullets. Style. The top=parseInt (bullets. Style. Top) - 10; <br/>If (parseInt (bullets. Style. Top) & lt; 30) {<br/>//alert (" none "); <br/>Bullets. Style. The display="none"; <br/>} <br/>//bullet hit the enemy, change image <br/>If (parseInt (bullets. Style. Top) - parseInt (enemy. Style. Top) & lt; 50 <br/>& & The parseInt (bullets. Style. Left) - parseInt (enemy. Style. Left) & lt; 30 <br/>& & ParseInt (bullets. Style. Top) & gt; The parseInt (enemy. Style. Top) <br/>& & The parseInt (bullets. Style. Left) & gt; The parseInt (enemy. Style. Left)) {<br/>//alert (" burst "); <br/>Enemy. Style. Background="url (hong2. PNG)"; <br/>} <br/><br/>If (parseInt (bullets. Style. Top) - parseInt (enemy1. Style. Top) & lt; 50 <br/>& & The parseInt (bullets. Style. Left) - parseInt (enemy1. Style. Left) & lt; 30 <br/>& & ParseInt (bullets. Style. Top) & gt; The parseInt (enemy1. Style. Top) <br/>& & The parseInt (bullets. Style. Left) & gt; The parseInt (enemy1. Style. Left)) {<br/>//alert (" burst "); <br/>Enemy1. Style. Background="url (hong2. PNG)"; <br/>} <br/><br/>If (parseInt (bullets. Style. Top) - parseInt (enemy2. Style. Top) & lt; 50 <br/>& & The parseInt (bullets. Style. Left) - parseInt (enemy2. Style. Left) & lt; 30 <br/>& & ParseInt (bullets. Style. Top) & gt; The parseInt (enemy2. Style. Top) <br/>& & The parseInt (bullets. Style. Left) & gt; The parseInt (enemy2. Style. Left)) {<br/>//alert (" burst "); <br/>Enemy2. Style. Background="url (hong2. PNG)"; <br/>} <br/><br/>If (parseInt (bullets. Style. Top) - parseInt (enemy3. Style. Top) & lt; 50 <br/>& & The parseInt (bullets. Style. Left) - parseInt (enemy3. Style. Left) & lt; 30 <br/>& & ParseInt (bullets. Style. Top) & gt; The parseInt (enemy3. Style. Top) <br/>& & The parseInt (bullets. Style. Left) & gt; The parseInt (enemy3. Style. Left)) {<br/>//alert (" burst "); <br/>Enemy3. Style. Background="url (hong2. PNG)"; <br/>} <br/>}, 60); <br/><br/><br/>} <br/><br/>//enemy move <br/>The function enemyMove () {<br/>//alert (" enemyMove "); <br/>Var left1=parseInt (Math. The random () * 3); <br/>Var left2=parseInt (Math. The random () * 3); <br/>Times=setInterval (function () {<br/>Enemy. Style. The top=parseInt (enemy. Style. Top) + 4; <br/>Enemy1. Style. The top=parseInt (enemy1. Style. Top) + 3; <br/>Enemy2. Style. The top=parseInt (enemy2. Style. Top) + 3; <br/>Enemy3. Style. The top=parseInt (enemy3. Style. Top) + 2; <br/><br/>//enemy2. Style. Left=parseInt (enemy2. Style. Left) + left1; <br/>//enemy3. Style. Left=parseInt (enemy3. Style. Left) - left2; <br/><br/>If (parseInt (enemy. Style. Top) & gt; 450) {<br/>//alert (" stop "); <br/>Var num=parseInt (Math. The random () * 350); <br/>//alert (num); <br/>Enemy. Style. The top=50; <br/>nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull </div> <div class="th_page th_page_color"></div> <div class="umCopyright"> <p>Page link:<a href="/frontend/26447.html" target="_blank" style="color:#999">https//www.codepudding.com/frontend/26447.html</a></p> </div> <div class="detail-arr"> <div class="detail-arr-left">Prev:<a href='/frontend/26446.html'>NullPointerException Fastdfs_ tracker. GetConnection ()</a></div> <div class="detail-arr-right">Next:<a href='/frontend/26448.html'>Access to the path of the node content</a></div> </div> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="hot-tags neitags"> <ul> <li><i class="iconfont icon-x-tags"></i> Tags:  </li> <a href='/e/tags/?tagname=JavaScript' target='_blank'>JavaScript</a> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="xiangguan"> <ul class="msg msghead"> <li class="tbname">Related</li> </ul> <ul> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="flinks"> <ul> <li><i class="iconfont icon-x-tags"></i> Links:  </li> <li class="liflinks"><a target="_blank" href="/" title="CodePudding">CodePudding</a></li> </ul> </div> </div> </div> </div> <div class="footer"> <p><span style="font-size:16px;color:#666;font-weight: bold">About Us:</span>  <a href="https://www.codepudding.com/contact.html">Contact Us</a>      <a href="https://www.codepudding.com/service.html">Terms of Service</a>      <a href="https://www.codepudding.com/privacy.html"> Privacy Policy</a></p> <p class="foot_info">Copyright © 2010-2023,Powered By <a href="/" target="_blank">CodePudding</a> </p> </div> <script type="text/javascript" src="/skin/code/tianhu.js"></script> </body></html>