I'll share the files now so you can play with it and give feedback. There's still more stuff to add (like tapping cards sideways and plugin commands), but this should provide a good base for simple card games.
CardDeck.js
Casino.js
CardDeck.js is the core file. Casino implements the card games that I've demonstrated in this thread, which you may use as a sample.
You want to inherit from Card_Base and Deck_Base for your own cards. The two functions you want to overwrite for your child class are initFront and initBack. These define how your cards look like. The default for these functions either fill the card with a single color or loads an image in 'img/card' folder. Look in Casino.js to see how I redefined them differently for Poker and Matches cards.
To draw the cards into the windows, I create as many Sprite_Buttons as will be displayed on the screen. First, buttons have inherent clickHandlers capability to handle mouse and tap inputs. Adding them as children to the window will automatically paint them onto the screen, as long as you set their visibility and bitmap properly.
Secondly, throughout the game, I will assign and update these button's bitmap variable to the appropriate card's _frontImage or _backImage, based on user's input and game conditions. for ex
Window_CasinoPokara.prototype.onCardClicked = function(index) { if ( ! this._isDeal) { // flip card when allowed to change cards var card = this._hand.cardList[index]; card.flip(); this._buttons[index].bitmap = card._bitmap; }};first I called 'card.flip()' to apply the card._bitmap to the correct side. then 'button.bitmap = card._bitmap' to assign the correct bitmap to the button which will be drawn onto the screen.That's only one way. You may find other ways to display the cards. For instance, since Card_Base already inherits from Sprite_Button, you can directly add the cards as children to the window. However, you would then have to handle each card's x, y positions, visibility and clickHandlers. This method may be better if the amount of cards on the table fluctuates and cards move frequently between zones.
In my poker game, I abstract each zone as separate decks. There are two decks used in the game: the main 'deck' and the player's 'hand'. When a player draws cards, it
copies cards from the 'deck' to the 'hand'. The Deck_Base class keep a counter of the current index for which card is considered the top card to deal out. This is just a shortcut for dealing games and may not be appropriate for all types of card games. Other games may want to actually
move cards between decks, not
copy them.