Scopa

Game development with Board Game Arena Studio
User avatar
tchobello
Posts: 526
Joined: 18 March 2012, 13:19

Scopa

Post by tchobello »

Hello,

I've chosen to implement the italian card game Scopa as a first project.

That is quite a job to handle PHP, Javascript & CSS all together ;)
I've looked at Morgalad's excellent job on Incan Gold & tried to understand and recreate his very nice deck.
I've taken the cards from an online game (baaad) but it's only a private project of a public domain game.

I'm a little bit struggling with the layout of my project which is a lot more basic.
I don't know why the two whiteblocks are twice the height they should have.

At the very beginning, each player receives 3 cards and 4 cards are dealt on the table...
I've created a DB table of 40 cards, a deck in relation with that table and 2 stocks, one for a player's hand and another one for cards on the table.
User avatar
fafa-fr
Posts: 383
Joined: 22 December 2013, 21:58

Re: Scopa

Post by fafa-fr »

godassesdor wrote:I don't know why the two whiteblocks are twice the height they should have.
I think you've solved this problem? At least for me it looks good, the whiteblocks have the expected size.
User avatar
tchobello
Posts: 526
Joined: 18 March 2012, 13:19

Re: Scopa

Post by tchobello »

yep, I had some help last night from the CSS master Morgalad !

I was really unaware about the .whiteblock and .stockitem hidden possibilities.
User avatar
tchobello
Posts: 526
Joined: 18 March 2012, 13:19

Re: Scopa

Post by tchobello »

I'm stuck again !
I can't move a card from my hand to the table...

I've followed hearts tutorial but it does nothing in the javascript playCardOnTable because $('myhand_item_' + card_id) is empty and should not.
I don't know what it is...

I've checked in the database and cards id are correct.
Should be easier than hearts because there are no mini boards here...
User avatar
fafa-fr
Posts: 383
Joined: 22 December 2013, 21:58

Re: Scopa

Post by fafa-fr »

godassesdor wrote:... because $('myhand_item_' + card_id) is empty and should not.
I don't know what it is...
Only a small error : you use 'myhand_item_x', but your div ids are 'mycards_item_x'
(just to be sure, this code is only for testing purpose? I mean, not using an ajax call to the server, not using addToStockWithId, ...)
User avatar
tchobello
Posts: 526
Joined: 18 March 2012, 13:19

Re: Scopa

Post by tchobello »

fafa-fr wrote: Only a small error : you use 'myhand_item_x', but your div ids are 'mycards_item_x'
(just to be sure, this code is only for testing purpose? I mean, not using an ajax call to the server, not using addToStockWithId, ...)
thanks...didn't know it could add _item_x to a div in the tpl.

well, it's a part of the playCardOnTable method in JS Utility :

Code: Select all

if (player_id != this.player_id) {
                // Some opponent played a card
                // Move card from player panel
                console.log("otherhand_item_ "+card_id);

                this.placeOnObject('cardontable_'+player_id, 'overall_player_board_' + player_id);
            } 
            else {
                // You played a card. If it exists in your hand, move card from there and remove
                // corresponding item
                console.log("mycards_item_ "+card_id);
                if ($('mycards_item_' + card_id)) {
                    console.log("cardontable_"+player_id);
                    this.placeOnObject('cardontable_'+player_id, 'mycards_item_' + card_id);
                    this.playerHand.removeFromStockById(card_id);
                }
            }
            // In any case: move it to its final destination
            this.slideToObject('cardontable_'+player_id, 'tablecards').play();
I've put some console.log just to trace.
The card is removed thanks to your help.
I have to look at the jstpl because the new one doesn't appear instead neither is moved to the table
User avatar
fafa-fr
Posts: 383
Joined: 22 December 2013, 21:58

Re: Scopa

Post by fafa-fr »

godassesdor wrote:I have to look at the jstpl because the new one doesn't appear instead neither is moved to the table
If you want to have this card appear in the "tablecards" Stock, you need to use addToStockWithId(), not a jstpl (the 3rd argument (optionnal) makes the card slide from one stock to another, see the Stock page in the Studio doc, in the tips at the end of the page, situation B).
User avatar
tchobello
Posts: 526
Joined: 18 March 2012, 13:19

Re: Scopa

Post by tchobello »

fafa-fr wrote:
godassesdor wrote:I have to look at the jstpl because the new one doesn't appear instead neither is moved to the table
If you want to have this card appear in the "tablecards" Stock, you need to use addToStockWithId(), not a jstpl (the 3rd argument (optionnal) makes the card slide from one stock to another, see the Stock page in the Studio doc, in the tips at the end of the page, situation B).
I tried with a jstpl because they did that trick in Hearts when the card appearing on the table is not one of yours.
User avatar
fafa-fr
Posts: 383
Joined: 22 December 2013, 21:58

Re: Scopa

Post by fafa-fr »

godassesdor wrote:
fafa-fr wrote:
godassesdor wrote:I have to look at the jstpl because the new one doesn't appear instead neither is moved to the table
If you want to have this card appear in the "tablecards" Stock, you need to use addToStockWithId(), not a jstpl (the 3rd argument (optionnal) makes the card slide from one stock to another, see the Stock page in the Studio doc, in the tips at the end of the page, situation B).
I tried with a jstpl because they did that trick in Hearts when the card appearing on the table is not one of yours.
I didn't look very deep in Hearts tutorial, but I think she used a jstpl to place cards on table because she uses a Stock only for the player's hand, not for cards on table (since there's only 1 card in each playertable div). If you use a Stock for cards on table, you must use addToStockWithId.
User avatar
fafa-fr
Posts: 383
Joined: 22 December 2013, 21:58

Re: Scopa

Post by fafa-fr »

godassesdor wrote:didn't know it could add _item_x to a div in the tpl.
BGA's Stock component does this: when you use
this.playerHand.addToStockWithId(this.getCardUniqueId(color, value), card.id);
the method adds a div "mycards_item_24" (or another id, depending on card.id value) in the "mycards" div. ("mycards" because in your Stock creation you wrote this.playerHand.create( this, $('mycards'), ...)
Post Reply

Return to “Developers”