Report as inappropriate.
Click and drag the cards around, press the green button to create a new random card and hold the right mouse button down to filp the card over.
This may be of help to anyone wanting to implement card games in Greenfoot... Though remember to copy all the images (in resources/cards) over to your project (as well as the Card source code) if you want to use this in your own scenarios.
As an aside, this could also be used as a demo of enums (enumerations.) Have a look in the Card class to see why!
Updates:
- Got rid of the button and added a deck instead.
- You can create a normal deck, or specify the numbers of sets of different suits you want. You can also specify whether or not you want to include jokers.
- When the deck is empty, it just shows an outline.
- Press space to refill the deck and get rid of the cards.
- The card that you're dragging or have dragged last now appears on top of all the others.
- Added a couple more methods to Deck and Card that may come in useful.
14120 views / 19 in the last 7 days
7 votes | 0 in the last 7 days
This scenario is a member of: Reusable actors & support classes
Want to leave a comment? You must first log in.
2009/4/23
2013/5/17
2022/12/8