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

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:

主站蜘蛛池模板: 银川市| 武宣县| 黑龙江省| 南阳市| 广德县| 孝感市| 赫章县| 灌南县| 绥滨县| 荃湾区| 南澳县| 三都| 漯河市| 衡南县| 高邑县| 谢通门县| 胶州市| 娄烦县| 蒙阴县| 伊宁市| 连城县| 乐山市| 公主岭市| 阿拉善右旗| 泾川县| 太仆寺旗| 绩溪县| 建阳市| 蓬莱市| 海南省| 石渠县| 西丰县| 泗水县| 广昌县| 东平县| 交城县| 蒙城县| 江西省| 新竹县| 六盘水市| 防城港市|