A keyboard and letter game written by jsOO

Source: Internet
Author: User
Today, I used OO to write a keyboard and letters game, which can be used for normal keyboard exercises. What's wrong? Thank you for pointing out. Mainly achieved results: 1. the accumulation of points is realized; 2. points... syntaxHighlighter. all (); News & nbsp; today I used OO to write a keyboard-letter game, which can be used for normal keyboard exercises. If it is hard to write, thank you for pointing out. Mainly achieved results: 1. Accumulated points; 2. Upgraded points to a certain extent; 3. Game failure when letters fall to a certain extent. The following code is provided:
                          Keyboard game full version Script var speet = 1; // The moving speed function createDiv () {var createbutton = document. createElement ("div"); createbutton. style. width = "800px"; createbutton. style. height = "1000px"; createbutton. style. border = "2px solid"; document. body. appendChild (createbutton);} function createSource () {var createSource; var score = 500; // The lowest point for the upgrade var sco = 0; // The Point var I = 1; // level init (); function init () {createSource = document. createElement ("div"); createSource. style. width = "100px"; createSource. style. height = "20px"; createSource. style. border = "1px solid blue"; createSource. innerHTML = "points:" + sco; createSource. position = "absolute"; document. body. appendChild (createSource);} this. leijia = function () {sco + = 10; createSource. innerHTML = "points:"; createSource. innerHTML = "points:" + sco; // alert (zhengbai); if (sco = score) {score + = 500; alert ("Congratulations to the upgrade: "+ I ++); speet + = 1; alert (" speert ----------------- "+ speet) ;}} function CharA (charDiv) {var CharArray = new Array ("A", "B", "C", "D", "E", "F", "G", "H ", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R ", "S", "T", "U", "V", "W", "S", "Y", "Z"); var a; init (); function init () {a = document. createElement ("div"); var charDiv = CharArray [parseInt (Math. random () * 26)];. innerHTML = charDiv;. style. width = "50px";. style. position = "absolute";. style. height = "50px";. style. top = "50px";. style. left = Math. random () * 100 + Math. random () * 500 + 50 + "px"; document. body. appendChild (a);} this. shoaa = function () {init ();} this. move = function () {. style. top = parseInt (. style. top) + speet + "px"; if (parseInt (. style. top)> 700) {alert ("game over"); clearInterval (time) ;}} this. charinner = function () {return. innerHTML;} this. hidden = function () {. style. display = "none"; document. body. removeChild (a) ;}} function Game () {var chars = new Array (); var cs = new createSource (); createDiv (); function initData () {for (var I = 0; I <10; I ++) {var charA = new CharA (); chars. push (charA) ;}} initData (); this. start = function () {time = setInterval (function () {for (var I = 0; I
  
 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.