- Vue.js 2 Web Development Projects
- Guillaume Chau
- 138字
- 2021-07-02 22:34:37
Drawing cards
Before drawing the cards, we will need to add two properties to the app state in the state.js file:
var state = {
// ...
drawPile: pile,
discardPile: {},
}
The drawPile property is the pile of cards that can be drawn by the players. It is initialized with the pile object defined in the cards.js file. Each key is the ID of a card definition, and the value is the amount of cards of this type in the pile.
The discardPile property is the equivalent of the drawPile property, but it serves a different purpose--all the cards played by the player will be removed from their hand and put into the discard pile. At some point, if the draw pile is empty, it will be refilled with the discard pile (which will be emptied).
推薦閱讀
- HTML5+CSS3王者歸來
- Visual FoxPro 程序設計
- Java FX應用開發教程
- Flask Web開發入門、進階與實戰
- Mastering matplotlib
- 實戰低代碼
- JavaScript從入門到精通(第3版)
- Mastering ServiceNow(Second Edition)
- RSpec Essentials
- Unity 3D腳本編程:使用C#語言開發跨平臺游戲
- 從零開始:UI圖標設計與制作(第3版)
- Serverless Web Applications with React and Firebase
- Android Development Tools for Eclipse
- Java EE Web應用開發基礎
- Python Deep Learning