主人公の絵が完成。ゲームに組み込んでみた
主人公の女子高生の全ての動きの絵が完成しましたので、ゲームに組み込んで正しく表示される事を確認しました。
また、飛行時の絵を切り替える位置も最適化し、できるだけよく動くように調整しました。
本物のスペハリは地面を走っていると茂みに弾を当てるのが結構難しいのですが、自分のバージョンでは特にそのようにはしていないので、より茂みに当りやすいようショットの頻度を落としてプレイ動画を撮りました。
お気づきかもしれませんが、色の濃い茂みと薄い茂みでは当ったときのリアクションが少し違います。
濃い茂みの場合は少しよろめいてすぐに復活するのですが、薄い茂みの場合はかなりよろめいて手をばたばた動かします。
ちなみに、本物のスペハリもこうなっています。
前回の記事に書いたとおり、よろめく絵はできるだけ時間を掛けずに描きましたが、ゲームに組み込んだ状態だと特にクオリティが劣化している感じはしないと思います。
なお、よろける時のテクスチャーの切り替えはcocos2dのアクションを使っています。
通常時は地面を走るアニメーションをCCRpeatForeverで繰り返しているのですが、茂みとのコリジョン判定がされると、下記のメソッド(これは大きいよろめきの方です)が呼ばれ、よろめくアニメーションを再生します。
- (void)actionOuchBig { id texture0 = [CCCallBlock actionWithBlock:^{ CCSpriteFrame* frame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:@"ouch_girl0.png"]; [self setDisplayFrame:frame]; self.position = ccp(self.position.x, self.contentSize.height/3.0); }]; id texture1 = [CCCallBlock actionWithBlock:^{ CCSpriteFrame* frame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:@"ouch_girl1.png"]; [self setDisplayFrame:frame]; self.position = ccp(self.position.x, self.contentSize.height/3.0); }]; id texture2 = [CCCallBlock actionWithBlock:^{ CCSpriteFrame* frame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:@"ouch_girl2.png"]; [self setDisplayFrame:frame]; self.position = ccp(self.position.x, self.contentSize.height/3.0); }]; id texture3 = [CCCallBlock actionWithBlock:^{ CCSpriteFrame* frame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:@"ouch_girl3.png"]; [self setDisplayFrame:frame]; self.position = ccp(self.position.x, self.contentSize.height/3.0); }]; id texture4 = [CCCallBlock actionWithBlock:^{ CCSpriteFrame* frame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:@"ouch_girl4.png"]; [self setDisplayFrame:frame]; self.position = ccp(self.position.x, self.contentSize.height/3.0); }]; id texture5 = [CCCallBlock actionWithBlock:^{ CCSpriteFrame* frame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:@"ouch_girl5.png"]; [self setDisplayFrame:frame]; self.position = ccp(self.position.x, self.contentSize.height/3.0); }]; id texture6 = [CCCallBlock actionWithBlock:^{ CCSpriteFrame* frame = [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:@"ouch_girl6.png"]; [self setDisplayFrame:frame]; self.position = ccp(self.position.x, self.contentSize.height/3.0); }]; id stopControl = [CCCallBlock actionWithBlock:^{ [_targetManager pauseShooting]; [[SEManager sharedManager] playSE:@"ouch.aiff" keyword:@"Player"]; _controlPaused = YES; _collisionPaused = YES; [self stopAction:_repeat]; }]; id resumeControl = [CCCallBlock actionWithBlock:^{ [_targetManager resumeShooting]; _controlPaused = NO; _collisionPaused = NO; [self runAction:_repeat]; }]; id animSeq = [CCSequence actions: texture0, [CCDelayTime actionWithDuration:4/60.0], texture1, [CCDelayTime actionWithDuration:4/60.0], texture2, [CCDelayTime actionWithDuration:4/60.0], texture3, [CCDelayTime actionWithDuration:4/60.0], texture4, [CCDelayTime actionWithDuration:4/60.0], texture5, [CCDelayTime actionWithDuration:4/60.0], texture6, [CCDelayTime actionWithDuration:4/60.0], texture1, [CCDelayTime actionWithDuration:4/60.0], texture0, [CCDelayTime actionWithDuration:4/60.0], nil]; id sequence = [CCSequence actions:stopControl, animSeq, resumeControl, nil]; [self runAction:sequence]; }
キャラクターを描くのに少し飽きたので、次は背景に手を入れたいと思います。
https://itunes.apple.com/jp/app/travelshooting-jp-toraberushutingu/id917570972?mt=8&uo=4&at=10laCt
https://itunes.apple.com/jp/app/beecluster-wu-liaono-zongsukurorushutingugemu/id663801586?mt=8&uo=4&at=10laCt