search
HomeDaily ProgrammingHTML KnowledgeNative JS implements the don't step on white block game (11)

How to implement the Don’t Step on White Blocks game using native js. We have explained the implementation method in detail through the previous series of articles and videos. We hope that it will be helpful to friends who are interested. s help.

Native JS implements the don't step on white block game (11)

#This section mainly introduces you to the js method of the last part of the don’t step on white block game.

For the complete code of the Don’t Step on the White Blocks game, please refer to: "Native JS Implementation of the Don’t Step on the White Blocks Game (1)"

The relevant js code is as follows:

go.children[0].onclick = function () {

    if (main.children.length) {

        //暴力清楚main里面所有盒子

        main.innerHTML = '';

    }

    //清空计分

    count.innerHTML = '游戏开始';

    //隐藏开始盒子

    this.parentNode.style.display = "none";

    move(main);

}

This code mainly means that when the div "go" is clicked, that is, "click to start", a series of functions and methods in the above code will be called.

Native JS implements the don't step on white block game (11)

In the above method, if there is a row under main, that is, when there is a row of square elements in the game area, we pass main.innerHTML = '', Violently clear all boxes in main. And clear the score, set to display "Game Start" and hide "Click to Start". Then call the move method, and the CDiv method will be called in the move method. In this way, the dynamic method loop can realize the "Don't Step on White Blocks" game.

Regarding the move and CDiv methods, we have also introduced them in detail in previous articles. Friends in need can refer to the following related articles.

Related articles:

Don’t step on the white block game implemented with native JS (2)

Don’t step on the implementation of native JS White Block Game (3)

Native JS implementation of the Don’t Step on White Block Game (4)

Native JS realizes the mini-game of “Don’t step on the white tiles” (5)

Native JS realizes the mini-game of “Don’t step on the white tiles” (6)

Native JS realizes the mini game of Don’t step on the white blocks (7)

Native JS realizes the mini game of Don’t step on the white blocks ( 8)

Don’t step on the white block game with native JS implementation (9)

This article is about the implementation of native js. The introduction to the method of stepping on white blocks is actually very simple. I hope it will be helpful to friends who are interested!

The above is the detailed content of Native JS implements the don't step on white block game (11). For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),