Hi!
I'm a newbie in BGA studio. I try to develop a card game and I am stuck just at the beginning...
I'd like to add a hand for each player using the stock component. Creating it works wells but the app crashes when I try addToStock, throwing this error in Firebug -> network :
Here's the code I typed :
In .tpl :
In .js
CSS sprite : my image contains 15 cards on the first row, and 10 cards on the others
When I comment "stock.addToStock(1);", the app does not crash.
Any idea what I did wrong ?
Tcheby
I'm a newbie in BGA studio. I try to develop a card game and I am stuck just at the beginning...
I'd like to add a hand for each player using the stock component. Creating it works wells but the app crashes when I try addToStock, throwing this error in Firebug -> network :
Code: Select all
During pageload _799(...) is undefined .cache["dojo/string"]/</_797.substitute/<@http://1.studio.boardgamearena.com:8081/data/themereleases/140706-1531/js/modules/layer/ly_studio.js:15:308670 .cache["dojo/string"]/</_797.substitute@http://1.studio.boardgamearena.com:8081/data/themereleases/140706-1531/js/modules/layer/ly_studio.js:15:308479 .cache["ebg/stock"]/</<.updateDisplay@http://1.studio.boardgamearena.com:8081/data/themereleases/140706-1531/js/modules/layer/ly_studio.js:15:606815 .cache["ebg/stock"]/</<.addToStockWithId@http://1.studio.boardgamearena.com:8081/data/themereleases/140706-1531/js/modules/layer/ly_studio.js:15:604061 .cache["ebg/stock"]/</<.addToStock@http://1.studio.boardgamearena.com:8081/data/themereleases/140706-1531/js/modules/layer/ly_studio.js:15:603572 .addStock@http://1.studio.boardgamearena.com:8081/data/themereleases/140706-1531/games/innovation/999999-9999//innovation.js?1409167468175:199:4 .setup@http://1.studio.boardgamearena.com:8081/data/themereleases/140706-1531/games/innovation/999999-9999//innovation.js?1409167468175:68:5 .cache["ebg/core/gamegui"]/</<.completesetup@http://1.studio.boardgamearena.com:8081/data/themereleases/140706-1531/js/modules/layer/ly_studio.js:15:182357 @http://en.1.studio.boardgamearena.com/innovation?table=17098:802:2594 _c6@http://1.studio.boardgamearena.com:8081/data/themereleases/140706-1531/js/dojoroot/dojo/dojo.js:15:11344 _36@http://1.studio.boardgamearena.com:8081/data/themereleases/140706-1531/js/dojoroot/dojo/dojo.js:15:12971 _7b/<@http://1.studio.boardgamearena.com:8081/data/themereleases/140706-1531/js/dojoroot/dojo/dojo.js:15:13217 _37@http://1.studio.boardgamearena.com:8081/data/themereleases/140706-1531/js/dojoroot/dojo/dojo.js:15:13061 _7b@http://1.studio.boardgamearena.com:8081/data/themereleases/140706-1531/js/dojoroot/dojo/dojo.js:15:13142 _32/_ee@http://1.studio.boardgamearena.com:8081/data/themereleases/140706-1531/js/dojoroot/dojo/dojo.js:15:14774 req.injectUrl/_108@http://1.studio.boardgamearena.com:8081/data/themereleases/140706-1531/js/dojoroot/dojo/dojo.js:15:17584In .tpl :
Code: Select all
<div id="test"></div>Code: Select all
constructor: function(){
console.log('innovation constructor');
// Here, you can init the global variables of your user interface
this.card_width = 196;
this.card_height = 140;
this.colors = new Array('blue','red','green','yellow','purple');
},
/*
setup
*/
setup: function( gamedatas )
{
console.log( "Starting game setup" );
this.pile = this.addStock($('test'), "cards.jpg");
// Setup game notifications to handle (see "setupNotifications" method below)
this.setupNotifications();
console.log( "Ending game setup" );
},
...
addStock: function(container, source_img)
{
stock = new ebg.stock();
stock.create(this, container, this.cardwidth, this.cardheight);
stock.image_items_per_row = 15;
var id = 0;
for(var i=1; i<11; i++)
{
if(i==1){var max = 15;} else{var max = 10;}
for(var j=0; j<max; j++)
{
id++;
stock.addItemType(id, id, g_gamethemeurl+'img/'+source_img, id);
}
}
alert(stock.count());
stock.addToStock(1);
return stock;
},When I comment "stock.addToStock(1);", the app does not crash.
Any idea what I did wrong ?
Tcheby