Help with dealing cards - slide in effect (file attached)
sawkastee
Member Posts: 184
I've worked on this for a few days and I've hit a mental wall. I want a deck of 52 cards to slide-in from the top of the screen. I am trying for an effect like a dealer is passing you a card and it is sliding into your view. I want each newly dealt card to stack on top of the previous cards. I am having problems setting up a spawner that will go through all 52 cards. When touch is pressed it must spawn a random card from my table and interpolate (slide-in) from off screen onto the screen. I also can't get the cards to stack since I am deleting the card's row.id from my table, hence eliminating the previously dealt cards. I hope this all makes sense. Any assistance with this file is greatly appreciated!!!
https://www.dropbox.com/sh/165lo5sl1vqgh1n/IF5rwJxJD8
https://www.dropbox.com/sh/165lo5sl1vqgh1n/IF5rwJxJD8
Comments
If your problem is that you are deleting rows from a table, why not use two tables (toDeal and Dealt)?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
To get a card, store a random number between 1 and the number of rows left in the editable table. Pull that card from the table then delete the row at that index(the stored random number).
I've made you a card-deal-from-the-top demo (hit the 'deal' button) - I've stuck a little randomness into the card's landing position and rotation (I think it adds a little realism).
https://www.mediafire.com/?jw9j0cvm0l6bvn9
. . .
Ok so I'm using the card deal from the top demo. My cards dealt face up, I imported 52 card images. I created a master table (52 cards) and copy it to child table before I start removing rows from child table. I change an attribute self.row to random table row count of the child table when deal button is pressed. Card self image is equal to a row's ".png" of the child table. Issue I am having is getting the cards to stack when they are face up because I remove the tables row at self.row after I use it. How can I get the cards to stack on top of each other and keep the card image?
:-/
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User