HomeForumsGeneral DiscussionImplementing a BulletCache and Manager into Quexlor

This topic has 2 voices, contains 2 replies, and was last updated by  Nat Weiss 146 days ago.

Viewing 3 posts - 1 through 3 (of 3 total)
Author Posts
Author Posts
December 21, 2011 at 6:08 am #586

GPP

1. Getting the player. attack to trigger bullets creation. This involves the Player class actually recognizing a bullet class.
(a) typing in the Player.h file @class Bullet; shows the Bullet class (although a mess) defined.
(b) how do I take these methods and integrate them into the -(void) attack:(Character*)attackee; method?

3. This attack method I created in Player.m, in order to override the one in Character.

-(void) attack:(Player*)attackee
{
	// get direction for animation
	//[self pointToward:attackee.position];
	// create attack sequence (animation + gotHit callback)
	CCAction* action = [CCSequence actions:
						[CCAnimate actionWithAnimation:[profile getAnimation:@"attack" index:currentDir]],
						[CCCallFuncND actionWithTarget:attackee selector:@selector(gotHit:data:) data:self],
						nil];
	action.tag = kActionAttack;
	[sprite runAction:action];
	BulletCache* bulletCache = [game bulletCache];
	//set the position, velocity, and spriteframe before shooting
	CGPoint shotPos = CGPointMake(player.position.x + [player contentSize].width * 0.5f,
								  player.position.y);
								  float spread = (CCRandom_0_1() -0.5f) * 0.5f;
								  CGPoint velocity = CGPointMake(1, spread);
								  [bulletCache shootBulletAt:shootPos velocity:velocity frameName:@”bullet.png”];
}

So now my question is this:
How do I incorporate the bullet manager into the bullet class so that the player’s attack method can shoot bullets?

December 21, 2011 at 7:39 am #2228

GPP

edit: realized that the code I have is using such an old version of cocos2d that CCSpriteBatchNode was under the file name CCSpriteSheet.

I am updating my cocos2d to 1.0.1 and then copying all the Quexlor files and resources over to my own project.

December 24, 2011 at 5:18 pm #2233

Nat Weiss

GPP. Just download the latest Kit. It comes with Cocos2d 1.0.1 and has a ton of improvements.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.