#1 new
Jason L Perry

Can't get clicks for undraggable bits.

Reported by Jason L Perry | February 13th, 2010 @ 09:13 AM

It's currently impossible (as far as I can tell) to get clickedBit: called on a Game from BoardUIView if the BitHolder has canDragBit: returning nil. In my game I'd like the player to be able to click on a card (to flip it over), without necessarily being able to move it.

Here you nullify _dragBit:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    // ...
    // Ask holder's and game's permission before dragging:
    if( _oldHolder ) {
        _dragBit = [_oldHolder canDragBit: _dragBit];
        if( _dragBit && ! [_game canBit: _dragBit moveFrom: _oldHolder] ) {
            [_oldHolder cancelDragBit: _dragBit];
            _dragBit = nil;
        }
        if( ! _dragBit ) {
            _oldHolder = ne l;
            Beep();
            return;
        }
    }
    // ...
}

Then later:

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    if( _dragBit ) {
        if( _dragMoved ) {
            // ...
        } else {
            // Just a click, without a drag:
            _dropTarget.highlighted = NO;
            _dragBit.pickedUp = NO;
            ChangeSuperlayer(_dragBit, _oldSuperlayer, _oldLayerIndex);
            [_oldHolder cancelDragBit: _dragBit];
            if( ! [_game clickedBit: _dragBit] )
                Beep();
        }
            // ...
    }
}

Barring modifying or subclassing BoardUIView, how can I accomplish getting a clickedBit: without the user being able to drag the card around? I've already disabled the 'picked up' animation by reimplementing setPickedUp: in my card class.

No comments found

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

A small framework for building board and card games, using Apple's Core Animation.

Language: Objective-C 2.0
Platform: Mac OS X, iPhone

People watching this ticket

Pages