This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

mjrb4
mjrb4 presents ...

2009/4/22

Card Demo

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.

7891 views / 15 in the last 7 days

6 votes | 0 in the last 7 days

Tags: mouse demo with-source

This scenario is a member of: Reusable actors & support classes


open in greenfoot
Your browser does not support the canvas tag.
astutikastutik

2009/4/23

i like it
A new version of this scenario was uploaded on Thu Apr 23 12:46:04 UTC 2009
A new version of this scenario was uploaded on Thu Apr 23 19:33:18 UTC 2009
MrCohenMrCohen

2013/5/17

This is a great asset! I was going to make a weekend project out of creating my own, but this does an excellent job - very modular, well-commented and useful. Thanks!!

Want to leave a comment? You must first log in.

Who likes this?

MrCohen ananaz ThatOneGuy 4xtra bourne spaceblue