Permalink
Browse files

more code cleanup and comments

  • Loading branch information...
1 parent 883586f commit aa494c56819fd320354ef6c8048ad9bd1ce440cb @RolandasRazma committed Jan 18, 2012
Showing with 10 additions and 17 deletions.
  1. +6 −6 iOS/Classes/Scenes/UDCharacter.m
  2. +2 −2 iOS/Classes/Scenes/UDHelpScene.m
  3. +2 −9 iOS/Classes/Scenes/UDPickMapScene.m
@@ -76,7 +76,7 @@ - (void)walkByPath:(NSUInteger)path {
CGPoint pathPart1 = CGPointZero;
CGPoint pathPart2 = CGPointZero;
- NSUInteger side = 0;
+ NSInteger side = -1;
switch ( [self opositeSideOfSide:[self rotationSide]] ) {
case SideTop: {
@@ -197,6 +197,7 @@ - (void)walkByPath:(NSUInteger)path {
}
}
+ // Will character walk straight line, or will he will make turn?
if( pathPart2.x == 0 && pathPart2.y == 0 ){
[self runAction:[CCSequence actions:
[CCCallFunc actionWithTarget:_delegate selector:@selector(charWillBeginWalking)],
@@ -260,18 +261,17 @@ - (void)setPosition:(CGPoint)pos {
- (void)nextFrame {
- //setDisplayFrameWithAnimationName
- //[self setDisplayFrame:@"walk" index:_charFrame];
+ // Manualy advance animation frame
[self setDisplayFrameWithAnimationName:@"walk" index:_charFrame];
- _charFrame++;
- if( _charFrame > 7 ) _charFrame = 0;
+ if( ++_charFrame > 7 ) _charFrame = 0;
}
- (void)reset {
_charFrame=2;
- //[self setDisplayFrame:@"walk" index:1];
+
+ // Reset animation frame
[self setDisplayFrameWithAnimationName:@"walk" index:1];
}
@@ -60,9 +60,9 @@ - (id)init {
fontSize: (isDeviceIPad()?32:15)];
if( isDeviceIPad() ){
- [label setPosition:CGPointMake(_winSize.width/2, _winSize.height -240)];
+ [label setPosition:CGPointMake(_winSize.width /2, _winSize.height -240)];
}else{
- [label setPosition:CGPointMake(_winSize.width/2, _winSize.height -70)];
+ [label setPosition:CGPointMake(_winSize.width /2, _winSize.height -70)];
}
[label setColor:ccBLACK];
@@ -325,8 +325,7 @@ - (CCSprite *)addButtonOfMapNo:(NSUInteger)no at:(CGPoint)pos {
[map addChild:lockSprite];
}
-
- if( [[CCDirector sharedDirector] contentScaleFactor] > 1 ){
+ if( [[CCDirector sharedDirector] contentScaleFactor] > 1.0f ){
[map setScale:0.9f];
}
@@ -344,11 +343,6 @@ - (CCSprite *)addButtonOfMapNo:(NSUInteger)no at:(CGPoint)pos {
- (void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
_didScroll = NO;
_touchDownLocation = [self convertTouchToNodeSpace: [touches anyObject]];
- /*
- _touchDownLocation = [[touches anyObject] locationInView: [[touches anyObject] view]];
- _touchDownLocation = [_backgroundLayer convertToNodeSpace:_touchDownLocation];
- _touchDownLocation = [[CCDirector sharedDirector] convertToGL: _touchDownLocation];
- */
}
@@ -357,7 +351,6 @@ - (void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
if ( [touches count] == 1 ) {
UITouch *touch = [touches anyObject];
-
CGPoint touchUpLocation = [self convertTouchToNodeSpace: touch];
if( _didScroll == NO && ccpDistance(_touchDownLocation, touchUpLocation) < 20 ) return;
@@ -399,7 +392,7 @@ - (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
[sprite setColor:ccGREEN];
[[SimpleAudioEngine sharedEngine] playEffect:@"click.caf"];
- [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunes.apple.com/app/ballwhirl/id380886785?mt=8"]];
+ [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=380886785&mt=8"]];
break;
}

0 comments on commit aa494c5

Please sign in to comment.