and this marks my first 2d animation since… i can’t even remember. do stick figures in high-school textbooks count?
Category Archives: Uncategorized
Think I found some good ref
Needed a touch of liquify tho…
Adding Accelerometer Data
So easy.
Add to the init method
self.isAccelerometerEnabled = YES;
Then somewhere in your class, stick the following
- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration {
NSLog(@"tilting %f", acceleration.z);
//accelerator x
//So tilting to the left goes towards -1, tilting to the right goes towards 1;
//accelerator y
// tiling forward goes towards -1, tilting backwards goes towards 1;
//accelerator z
// flicking it upwards it goes towards and past 2, flicking it downwards it goes towards and past -2;
}
NSLog CCLOG Format Specifiers
I can never remember which one to use, so here’s the list
%@ Object %d, %i signed int %u unsigned int %f float/double %x, %X hexadecimal int %o octal int %zu size_t %p pointer %e float/double (in scientific notation) %g float/double (as %f or %e, depending on value) %s C string (bytes) %S C string (unichar) %.*s Pascal string (requires two arguments, pass pstr[0] as the first, pstr+1 as the second) %c character %C unichar %lld long long %llu unsigned long long %Lf long double
Detecting touch of a sprite in a sprite sheet
Because I’m going to be doing this a lot, I’m making a note of it.
So at the top of my page.m
enum {
kTagSpriteSheet = 1,
kTagSprite = 2,
};
In my init function
mySheet = [CCSpriteSheet spriteSheetWithFile:@"myatlas.png"];
[self addChild:mySheet z:0 tag:kTagSpriteSheet];
// create the sprite
mySprite = [CCSprite spriteWithTexture:mySheet.texture rect:CGRectMake(0, 0, 200,200)];
[mySheet addChild:mySprite z:0 tag:kTagSprite];
Then in ccTouchesEnded method
BOOL *isSpriteTouched = NO;
UITouch *touch = [touches anyObject];
CGPoint location = [touch locationInView:[touch view]];
location = [[CCDirector sharedDirector] convertToGL:location];
CCSpriteSheet *mySheet = (CCSpriteSheet*) [self getChildByTag: kTagSpriteSheet];
CCSprite *mySprite = (CCSprite*) [mySheet getChildByTag: kTagSprite];
CGRect myRect = CGRectMake(mySprite.position.x, mySprite.position.y, mySprite.contentSize.width,
mySprite.contentSize.height);
if(CGRectContainsPoint(myRect, location)) {
isSpriteTouched = YES;
}
cocos2d game tutorial
Great tutorial covering all the basics of cocos2d. Sprites, animation and sound effects.
http://www.raywenderlich.com/352/how-to-make-a-simple-iphone-game-with-cocos2d-tutorial
grannies?
Photoshop Keyboard Shortcuts
tile game tutorial
looks pretty good:
http://www.raywenderlich.com/1163/how-to-make-a-tile-based-game-with-cocos2d
concept sketches
Done in brushes. Here’s a timelapse (mp4, 580kb)
And a hideous zbrush test sculpt, mainly to get back in the groove after having not used it in aaaaages.