cs193p – Assignment #4 Task #7

Please note, this blog entry is from a previous course. You might want to check out the current one.

Animate re-deals.

The adding new cards part has already been handled by the previous task. Just animate the removal of the old cards by moving them to the bottom left corner:

- (IBAction)touchDealButton:(UIButton *)sender {
    ...
    for (UIView *subView in self.cardViews) {
        [UIView animateWithDuration:0.5
                         animations:^{
                             subView.frame = CGRectMake(0.0,
                                                        self.gridView.bounds.size.height,
                                                        self.grid.cellSize.width,
                                                        self.grid.cellSize.height);
                         } completion:^(BOOL finished) {
                             [subView removeFromSuperview];
                         }];
    }
    ...
}

The complete code is available on github.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #4 Task #6

Please note, this blog entry is from a previous course. You might want to check out the current one.

The arrival and departure of cards must be animated and, as they come and go, you must automatically adjust the layout of the cards in your user-interface (i.e. their size and position) to efficiently use the real estate on screen (i.e. don’t waste space) and make them all fit.

… a minor bug was introduced in task #3 … the code was added to the super class, thus also playing cards get removed which makes the game really difficult. Lets add a new public property to choose if card should be removed or stay:

@property (nonatomic) BOOL removeMatchingCards;

Continue reading “cs193p – Assignment #4 Task #6”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #4 Task #5

Please note, this blog entry is from a previous course. You might want to check out the current one.

Use a flip transition to animate choosing cards in the Playing Card game (so that the cards look like they are being flipped over when chosen).

When choosing a card, set that card to its new “future” state for the animation. When the animation is complete reset that change and run the “original” code of updating the game and the user interface:
Continue reading “cs193p – Assignment #4 Task #5”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #4 Task #4

Please note, this blog entry is from a previous course. You might want to check out the current one.

As in a real game of Set, the user should start with 12 cards and then have the option of requesting 3 more cards to be dealt at any time if he or she is unable to locate a Set. Do something sensible when there are no more cards in the deck.

Add a new button in storyboard and set its tag to 3 (the number of cards that should be added):

cs193p – assignment #4 task #4 – add cards button
cs193p – assignment #4 task #4 – add cards button

Continue reading “cs193p – Assignment #4 Task #4”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #4 Task #3

Please note, this blog entry is from a previous course. You might want to check out the current one.

When a Set match is successfully chosen, the matching cards should now be removed from the game (not just blanked out or grayed out, but removed from the UI entirely).

When looping of the cards check if it matches, if it does remove it from the super view and form the view array. Before creating a new view check, if the cared has already matched earlier, to avoid recreating its view:
Continue reading “cs193p – Assignment #4 Task #3”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #4 Task #2

Please note, this blog entry is from a previous course. You might want to check out the current one.

Cards must have a “standard” look and feel (i.e. for Set, 1, 2 or 3 squiggles, diamonds or ovals that are solid, striped or unfilled, and are either green, red or purple; for Playing Cards, pips and faces). You must draw these using UIBezierPath and Core Graphics functions. You may not use images or attributed strings for Set cards. The drawings on the card must scale appropriately to the card’s bounds. You can use the PlayingCardView from the in-class demo to draw your Playing Card game cards.

… the cleaning continues: Remove all card buttons from your storyboard, as well as their outlet collection property and every reference to it in your code. Because the cards will now drawn remove also the methods to update the button title and background images … like before, you can leave the code parts where the are, but it might get crowded …
Continue reading “cs193p – Assignment #4 Task #2”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail

cs193p – Assignment #4 Task #1

Please note, this blog entry is from a previous course. You might want to check out the current one.

Your application this week is still required to play both the Set and Playing Card matching games (in separate tabs) and must show the score and allow re-deals, but you can remove the UI for showing the result of the last card choice as well as the History MVC added last week.

From your storyboard remove the history view controller as well as the navigation view controllers. Relink both game view controllers with the tab view controllers. Finally remove the flip-description labels:

cs193p – assignment #4 task #1 – cleanup
cs193p – assignment #4 task #1 – cleanup

Continue reading “cs193p – Assignment #4 Task #1”

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail