tCreate a stock to store facedown cards - hadarawgs - Hadara adaptation for boardgamearena.com
(HTM) git clone git://git.z3bra.org/hadarawgs.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit d3d3a7725fe32bd40c60f7a95301ebaa70ed59fb
(DIR) parent 1f3a4f5dfb0e07314fd6a61d6e1a462eccf140f8
(HTM) Author: Willy Goiffon <dev@z3bra.org>
Date: Thu, 5 Mar 2020 17:51:44 +0100
Create a stock to store facedown cards
Diffstat:
M hadarawgs.js | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
---
(DIR) diff --git a/hadarawgs.js b/hadarawgs.js
t@@ -18,7 +18,8 @@
define([
"dojo","dojo/_base/declare",
"ebg/core/gamegui",
- "ebg/counter"
+ "ebg/counter",
+ "ebg/stock"
],
function (dojo, declare) {
t@@ -26,10 +27,9 @@ function (dojo, declare) {
constructor: function() {
console.log('hadarawgs constructor');
- // Here, you can init the global variables of your user interface
- // Example:
- // this.myGlobalValue = 0;
-
+ // global variables
+ this.cardwidth = 64;
+ this.cardheight = 95;
},
/*
t@@ -71,7 +71,19 @@ function (dojo, declare) {
});
}
- // Setup game notifications to handle (see "setupNotifications" method below)
+ this.deck = new ebg.stock();
+ this.deck.create(this, $('deck'), this.cardwidth, this.cardheight);
+ this.deck.image_items_per_row = 5;
+ this.deck.centerItems = true;
+ for (var epoch = 3; epoch > 0; epoch--) {
+ for (var type = 1; type < 6; type++) {
+ this.deck.addItemType((epoch-1)*5 + type, epoch, g_gamethemeurl+'img/cards.png', (epoch-1)*5 + type);
+ this.deck.addToStock((epoch-1)*5 + type, 'deck');
+ }
+ }
+ this.deck.setOverlap(50, 50);
+
+ // Setup game notifications to handle (see "setupNotifications" method below)
this.setupNotifications();
console.log( "Ending game setup" );