Skip to content

Instantly share code, notes, and snippets.

View tanapon's full-sized avatar

Tanapon Petapanpiboon tanapon

View GitHub Profile
@jeksys
jeksys / Lightning.h
Created August 23, 2011 19:19
Lighting, cocos2D
//
// Lightning.h
// Trundle
//
// Created by Robert Blackwood on 12/1/09.
// Copyright 2009 Mobile Bros. All rights reserved.
//
#import "cocos2d.h"
@talentless
talentless / TGScoreLabel.h
Created November 2, 2011 14:02
A Score Label for Cocos2d
#import <Foundation/Foundation.h>
#import "cocos2d.h"
@interface TGScoreLabel : CCLabelTTF {
double curScore_; // the current score value of the label
BOOL updating_; // if we currently have an update running
double interval_; // how long we wait between updates
int score; // the target score
NSString * formatString; // the string that we format
@bontoJR
bontoJR / MCCard.m
Created November 17, 2011 11:52
Realistic card turn with Cocos2d
- (void)turnCard
{
if ([self isFaceUp]) {
[self flipHide];
self.faceUp = NO;
} else {
self.faceUp = YES;
[self flipReveal];
}
}
@skyfe79
skyfe79 / gist:1593859
Created January 11, 2012 09:16 — forked from seanh/gist:1219425
Computing the "full bounding box" of a CCNode in Cocos2D. (Put this code in a CCNode subclass.)
/*!
Return the -boundingBox of another node, converted into this node's local
coordinate space.
*/
-(CGRect) boundingBoxConvertedToNodeSpace:(CCNode *)other
{
// Get the bottomLeft and topRight corners of the other node's bounding box
// in the other node's coordinate space.
CGRect boundingBox = [other boundingBox];
CGPoint bottomLeft = CGPointMake(boundingBox.origin.x, boundingBox.origin.y);
@tanapon
tanapon / NSString+NumberMethods.h
Created March 14, 2012 17:27
Adding Thousands Separator commas to a number manually without using NSNumber formatting method
//
// NSStringCategory.h
// AdamoCalc
//
// Created by Tanapon Petapanpiboon on 10/11/11.
// Copyright 2011 toptanapon@gmail.com. All rights reserved.
//
#import <Foundation/Foundation.h>