我不知道为什么它不能工作。粒子效果位于屏幕左下方,而不是它所碰撞的部分。
在.h文件中。
在.h文件中。
CCParticleExplosion *starsExplosion;
在.M文件中
位于碰撞下面
if(distance < 30) {
starsCollected += 100;
[_stars removeObject:stars];
//Stars Explosion
//starsExplosion.position = ccp(stars.contentSize.width, stars.contentSize.height);
starsExplosion = [[CCParticleExplosion alloc] init];
starsExplosion.position = ccp(stars.position.y, stars.position.x);
starsExplosion.texture = [[CCTextureCache sharedTextureCache] addImage:@"star-icon.png"];
[self addChild:starsExplosion];
[self removeChild:stars cleanup:YES];
}
我尝试使用ContentSize.Width
和height=
,但没有成功。
我还尝试使用Position.x
和y=
,同样不行。