- HTML5 Game Development by Example:Beginner's Guide(Second Edition)
- Makzan
- 184字
- 2021-07-16 14:10:00
Adding game logic to the matching game
Let's now imagine holding a real deck in our hand and setting up the matching game.
We would first shuffle the cards in our hands and then we would put each card on the table with the back facing up. For an easier gameplay, we align the cards into a 4 x 3 array. Now, the game is set up and we are going to play it.
We pick up one card and flip it to make it face up. We pick another one and face it upwards. Afterwards, we have two possible actions. We take away the two cards if they have the same pattern. Otherwise, we put them back facing down, as if we had not touched them. The game continues until we pair all of the cards.
The code flow will be much clearer after we have this step-by-step scenario in our mind. Actually, the code in this example is exactly the same as the procedure we play with a real deck. We just need to replace the human language into the JavaScript code.
- 編程卓越之道(卷3):軟件工程化
- Java Web基礎與實例教程(第2版·微課版)
- Mastering Julia
- SEO智慧
- Implementing Cisco Networking Solutions
- 實戰低代碼
- Getting Started with Python Data Analysis
- Windows Server 2016 Automation with PowerShell Cookbook(Second Edition)
- Building an RPG with Unity 2018
- Mastering Apache Spark 2.x(Second Edition)
- Android底層接口與驅動開發技術詳解
- R Data Analysis Cookbook(Second Edition)
- 單片機C語言程序設計實訓100例
- iOS開發實戰:從入門到上架App Store(第2版) (移動開發叢書)
- Python算法詳解