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

2011/12/20

How to make actors go on top of each other?

1
2
3
kiarocks kiarocks

2011/12/23

#
Is the drawPile like the Deck in my game?
danpost danpost

2011/12/23

#
The drawPile is a Pad object that I gave a value of -1 to. It IS (or contains) initially the entire deck. It appear to me that your Deck object is just an image (not actually the cards), where my drawPile is actually all 52 card objects, one on top of the other, before being dealt. I would have to take a closer look at your code to be sure, but a quick glance gave me that impression. ADDED: I guess in the sense that the cards are drawn from this stack during play, then YES, your Deck is like my drawPile (or will be similar to, as mine has no functionality, yet).
kiarocks kiarocks

2011/12/23

#
Ok, I wanted to double check
danpost danpost

2011/12/23

#
Major correction in Pad class. I have the act() method in pad calling a new method 'ensureTopCardUp()' which sets the showVal of the top-most card to one (1), if it is a 'play pad'. In the act() method of Card class, I added 'setImage(image);'. Then I got rid of everything else I had previously added to deal with the flip of the card. But then, nothing would flip. I had to re-arrange my 'addCard(Card)' method in Pad class to make it work. It now looks like this:
    public void addCard(Card card)
    {
        int cardVal = card.value;
        int cardShow = card.showVal;
        getWorld().removeObject(card);
        int stagger = 0; if (value > -1 && value < 7) stagger = 3;
        Card newCard = new Card(cardVal, cardShow);
        newCard.pad = this;
        cardList.add(cardCount, newCard);
        getWorld().addObject(newCard, getX() + (cardCount % 2) * stagger, 
            cardCount * 5 + upCardCount() * 22 + getY());
        cardCount++;
    }
kiarocks kiarocks

2011/12/23

#
I was writing my own addCard method because I have the card reAdded every time you drag it.
danpost danpost

2011/12/23

#
That is what happens in my addCard method. I had to change it around, because I was changing the Pad reference in the Card and the Card reference in the Pad before deleting it (needed to be done after re-creating it). So, actually, Pad did not have the correct reference to the new Card. Anyways, line 5 in my code removes the old card and lines 10 - 11 re-adds the card.
danpost danpost

2011/12/23

#
@kiarocks -- just an update. I have the card-dragging part implemented (kings can go to empty pads, cards can be moved up the their suit pads in order, and up-cards can be moved to other up-cards in the play area in decending opposite-color order. Now to work on cards from the draw pile. NOTE: I was getting an un-familiar error while trying to implement the card-dragging (something about comodification). I figured out that when a card is removed from the world, any references to that card in lists are automatically removed (I only had to change the instance integer variable cardCount for the pad the card(s) came from).
danpost danpost

2011/12/23

#
O, yeah, there is one more thing. Before working on the drawPile, I am going to work on the background. I will be adding something like semi-transparent aces at the suit-pads across the top, as well as empty card frames to indicate the 7 play-pad areas (so, you will notice when the pad is empty).
kiarocks kiarocks

2011/12/24

#
My pads are those images.
danpost danpost

2011/12/24

#
I want my pads to stay transparent (in case I decide to put them above the cards for more control).
kiarocks kiarocks

2011/12/24

#
Too much code wouldn't work together and i think ill just use my code.
danpost danpost

2011/12/25

#
http://i1100.photobucket.com/albums/g405/danpost269/SolitaireMidgame.pngUpdated image: mid-game
kiarocks kiarocks

2011/12/25

#
Cool, recovering my code right now.
You need to login to post a reply.
1
2
3