官术网_书友最值得收藏!

Mission briefing

We are going to create a matching game. This game presents a combination of patterns to the player, and some of these patterns overlap each other. Players analyze the patterns and then select them in the correct sequence so that the composition matches the provided one. You may visit the URL http://makzan.net/html5-games/color-quest/ to play the example game in order to have a better understanding of what we will build throughout this project.

The following screenshot shows the final result of this project. The upper part is a timer, the part to the left shows the quest, the right part is the composition of the player, and the lower part is the deck of patterns.

Why is it awesome?

A simple matching game like this is a perfect way to get you warmed up with the HTML5 games' development rhythm. What we will learn in this project is the foundation to build more complicated games later in this book.

This game uses what we are familiar with: HTML element interaction and styling in CSS. What's new, is JavaScript logic. This project will show us how to convert the game rule into code. We will also learn how to separate logic into different parts with different responsibilities.

Your Hotshot objectives

We'll perform the following tasks in this project:

  • Creating the HTML structure
  • Managing the game scenes
  • Representing the quest pattern composition
  • Placing the patterns on the deck
  • Selecting the pattern
  • Comparing players and compositions of the quest
  • Showing different quests
  • Counting down the game

Mission checklist

In this game, we are going to stick to plain JavaScript without using a library. This will help us get started with a basic foundation in JavaScript.

Note that writing JavaScript for games is a little bit different from writing it for a web page. Game logic requires well-structured code to ensure the logic is easy to read and maintained. The following essays provide an in-depth discussion on writing JavaScript in the right way:

主站蜘蛛池模板: 普兰县| 塘沽区| 哈密市| 万安县| 柳河县| 阳高县| 屏南县| 琼海市| 肇州县| 华蓥市| 仪征市| 麻阳| 远安县| 米泉市| 丰台区| 赤水市| 新绛县| 宁乡县| 宣化县| 麻江县| 房山区| 通河县| 鹤峰县| 澄迈县| 田东县| 泾川县| 芒康县| 黄平县| 民权县| 乐东| 禄丰县| 东丽区| 凉山| 香港| 岐山县| 徐闻县| 昭觉县| 余庆县| 神农架林区| 饶平县| 宝清县|