【发布时间】:2023-04-03 17:03:01
【问题描述】:
我不知道为什么它不起作用。粒子效果位于屏幕左下角,而不是碰撞的部分。
在.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 =,又是运气。
【问题讨论】:
-
不是我认为这是您问题的根源,但您在设置位置时不是交换 x 和 y 吗?