Skip to content

Instantly share code, notes, and snippets.

View dabing1022's full-sized avatar
👨‍💻
Focusing

ChildhoodAndy dabing1022

👨‍💻
Focusing
View GitHub Profile
// Feel free to use. MIT License
#import <Foundation/Foundation.h>
#import "cocos2d.h"
// Layer that will just capture any touch events on it
@interface OpaqueLayer : CCLayerColor {
}
@dabing1022
dabing1022 / Touch.m
Last active December 17, 2015 02:49
实现触摸
#pragma mark - touch delegate
- (CGPoint)locationFromTouch:(UITouch *)touch
{
CGPoint touchLocation = [touch locationInView:[touch view]];
return [[CCDirector sharedDirector]convertToGL:touchLocation];
}
- (BOOL)containsTouchLocation:(UITouch *)touch
{
CGRect selfRect = CGRectMake(self.position.x, self.position.y, self.contentSize.width, self.contentSize.height);
- (void)turnCard
{
if ([self isFaceUp]) {
[self flipHide];
self.faceUp = NO;
} else {
self.faceUp = YES;
[self flipReveal];
}
}