I have a question about some curios behavior of my card placement routine. This to deal out the empire cards at the beginning of the game, one to each of the 5 tables. I hard coded the routine to get it working right and there is some strange behavior I need to address before I start making the call with variables.
So the first call to the routine puts the card in a weird place. Inspecting the HTML puts the card at:
<div class="playertablecard empirecard" id="empirespot" style="background-position: 85px 60px; top: 326.236px; left: 437.146px;"> </div>
The 2nd call puts it here:
<div class="playertablecard empirecard" id="empirespot" style="background-position:85px 60px;"> </div>
Right where I want it. All the random positioning data is gone and all calls after the 1st one work fine. The first puts a random card out in the middle of the board.
****************
Is there something I need to clear out before I start making calls and putting the cards out?
****************
// the card_graphic_x and the card_graphic_y are the location of the particular card in the card
// graphic that contains all the cards (empire.png)
// empireToPlayOn is the empire play table to use (tables 1-5)
this.playEmpireCardOnTable(player_id, 1, 1, 1); // First call puts card in weird place
this.playEmpireCardOnTable(player_id, 1, 1, 1); // Puts card in right place. All calls after the 1st call work fine
playEmpireCardOnTable: function(player_id, card_graphic_x, card_graphic_y, empireToPlayOn)
{
console.log('PlayEmpireCardOnTable');
dojo.place(this.format_block('jstpl_empire_card', {
x : this.empirecardwidth * card_graphic_x,
y : this.empirecardheight * card_graphic_y}),
'empire' + empireToPlayOn);
this.placeOnObject('empirespot', 'overall_player_board_' + player_id);
this.slideToObject('empirespot', 'empire' + empireToPlayOn).play();
},
So the first call to the routine puts the card in a weird place. Inspecting the HTML puts the card at:
<div class="playertablecard empirecard" id="empirespot" style="background-position: 85px 60px; top: 326.236px; left: 437.146px;"> </div>
The 2nd call puts it here:
<div class="playertablecard empirecard" id="empirespot" style="background-position:85px 60px;"> </div>
Right where I want it. All the random positioning data is gone and all calls after the 1st one work fine. The first puts a random card out in the middle of the board.
****************
Is there something I need to clear out before I start making calls and putting the cards out?
****************
// the card_graphic_x and the card_graphic_y are the location of the particular card in the card
// graphic that contains all the cards (empire.png)
// empireToPlayOn is the empire play table to use (tables 1-5)
this.playEmpireCardOnTable(player_id, 1, 1, 1); // First call puts card in weird place
this.playEmpireCardOnTable(player_id, 1, 1, 1); // Puts card in right place. All calls after the 1st call work fine
playEmpireCardOnTable: function(player_id, card_graphic_x, card_graphic_y, empireToPlayOn)
{
console.log('PlayEmpireCardOnTable');
dojo.place(this.format_block('jstpl_empire_card', {
x : this.empirecardwidth * card_graphic_x,
y : this.empirecardheight * card_graphic_y}),
'empire' + empireToPlayOn);
this.placeOnObject('empirespot', 'overall_player_board_' + player_id);
this.slideToObject('empirespot', 'empire' + empireToPlayOn).play();
},