mobile_obj_parent parameter in slideTemporaryObject
Posted: 20 May 2020, 13:56
I finished the hearts tutorial and I am looking at the code for the solo game, because in the game that I want to create I was looking for an example of sliding cards with the back facing all non-active players.
It is this line of code that I am struggling to understand, specifically the mobile_obj_parent parameter
From the docs
In the .tpl file
So why is the parent fake_deck and not just deck since deck is the slide from anyway?
I guess I am missing the point of the element of fake_deck
Thank you
It is this line of code that I am struggling to understand, specifically the mobile_obj_parent parameter
Code: Select all
this.slideTemporaryObject( '<div class="single_card anim_cardback moving"></div>', 'fake_deck', 'deck',
'playercards_'+player_id, 1000, delay*50 );
Code: Select all
slideTemporaryObject does all of this for you:
mobile_obj_html is a piece of HTML code that represent the object to slide.
mobile_obj_parent is the ID of an HTML element of your interface that will be the parent of this temporary HTML object.
from is the ID of the origin of the slide.
to is the ID of the target of the slide.
duration/delay works exactly like in "slideToObject"
Code: Select all
<div id="cards" class="cards_fulltable">
<div class="single_card decknormal" id="deck">
<div id="nbr_cards">x -</div>
</div>
<div class="single_card" id="fake_deck"></div>
<div class="single_card" id="discard"></div>
</div>
I guess I am missing the point of the element of fake_deck
Thank you