粒子动画,cocos2d 警告/错误
我是 Objective C 世界的新手,并且刚刚熟悉 cocos2d 框架。我正在尝试构建一个基本的 touchEnabled 粒子动画应用程序,该应用程序调用子类 ccParticleMeteor。我在 .m 中收到以下编译器错误/警告,并且无法重新配置我的代码以消除这些编译器错误。如果需要任何其他说明,请告诉我...谢谢!
`conflicting types for '-(BOOL)ccTouchesBegan:(NSSET *)touches withEvent:(UIEvent *) event'
Previous Declaration of '-(void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event'
conflicting types for '-(BOOL)ccTouchesMoved:(NSSel *)touches withEvent:(UIEvent *)event'
Previous Declaration of '-(void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event'
'UITouch' may not respond to '-LocationInView:'
Errors
INVALID INTIALIZER. @ CGPoint touch line
LOCATION UNDECLARED. @ CGPoint point line
`- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if( (self=[super init])) {
self.isTouchEnabled = YES;
emitter = [[CCParticleMeteor alloc] init];
emitter.texture = [[CCTextureCache sharedTextureCache] addImage:@"starry1.png"];
emitter.position = ccp(320, 480);
[self addChild: emitter];
}
return self;
}
-(BOOL) ccTouchesBegan: (NSSet *)touches withEvent:(UIEvent *)event {
[self ccTouchesMoved:touches withEvent:event];
return YES;
}
-(BOOL) ccTouchesMoved: (NSSet *)touches withEvent:(UIEvent *)event {
UITouch *myTouch = [touches anyObject];
CGPoint touch = [myTouch LocationInView:[myTouch view]];
CGPoint point = [[CCDirector sharedDirector] convertToGL:location];
emitter.position = ccp(point.x, point.y);
return YES;
`
I am new to the objective c world and have been freshly acquainted with the cocos2d framework. I am trying to build a basic touchEnabled particle animation application that calls the subclass ccParticleMeteor. I am receiving the following compiler error/warnings in my .m and I am unable to reconfigure my code to eliminate these compiler errors. Let me know if any other clarification is needed...Thanks!
`conflicting types for '-(BOOL)ccTouchesBegan:(NSSET *)touches withEvent:(UIEvent *) event'
Previous Declaration of '-(void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event'
conflicting types for '-(BOOL)ccTouchesMoved:(NSSel *)touches withEvent:(UIEvent *)event'
Previous Declaration of '-(void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event'
'UITouch' may not respond to '-LocationInView:'
Errors
INVALID INTIALIZER. @ CGPoint touch line
LOCATION UNDECLARED. @ CGPoint point line
`- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if( (self=[super init])) {
self.isTouchEnabled = YES;
emitter = [[CCParticleMeteor alloc] init];
emitter.texture = [[CCTextureCache sharedTextureCache] addImage:@"starry1.png"];
emitter.position = ccp(320, 480);
[self addChild: emitter];
}
return self;
}
-(BOOL) ccTouchesBegan: (NSSet *)touches withEvent:(UIEvent *)event {
[self ccTouchesMoved:touches withEvent:event];
return YES;
}
-(BOOL) ccTouchesMoved: (NSSet *)touches withEvent:(UIEvent *)event {
UITouch *myTouch = [touches anyObject];
CGPoint touch = [myTouch LocationInView:[myTouch view]];
CGPoint point = [[CCDirector sharedDirector] convertToGL:location];
emitter.position = ccp(point.x, point.y);
return YES;
`
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这告诉您方法签名不匹配。在这种情况下,它应该是:
换句话说,“touches”方法不返回 BOOL。
This tells you that the method signatures don't match. In this case, it should be:
In other words, the "touches" methods don't return BOOL.