Hello, I'm a complete noob at Greenfoot and I am starting to give my first foots in programming in general. With this said I'm trying to do a card game and the first thing I thought of doing was dealing a random card when the deck is clicked. So far I have:
And then on the World class Table i have the following to call the Deck
But I have no luck in doing what it's meant to do ( Draw a random card on the table). I'm in need of some inspiration, and I'd like to have you guys reccomend tutorials before starting Greenfoot(already watched the most basics ones).
Thanks in advance.
public void Deck()
{
Baralho= new GreenfootImage ("redflip.png");
setImage(Baralho);
if (Greenfoot.mouseClicked(Deck))
{
switch( Greenfoot.getRandomNumber(3) )
{
case 0: setImage("cards/aceclubs.png"); break; //or whatever your image files are named
case 1: setImage("cards/acediamonds.png"); break;
case 2: setImage("cards/acehearts.png"); break;
}
}
}addObject(new Deck(), 100, 100);
