粒子动画,cocos2d 警告/错误

发布于 2024-12-20 01:58:38 字数 1524 浏览 2 评论 0原文

我是 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夏夜暖风 2024-12-27 01:58:38
`conflicting types for '-(BOOL)ccTouchesBegan:(NSSET *)touches withEvent:(UIEvent *) event'
Previous Declaration of '-(void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event'

这告诉您方法签名不匹配。在这种情况下,它应该是:

-(void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event

换句话说,“touches”方法不返回 BOOL。

`conflicting types for '-(BOOL)ccTouchesBegan:(NSSET *)touches withEvent:(UIEvent *) event'
Previous Declaration of '-(void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event'

This tells you that the method signatures don't match. In this case, it should be:

-(void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event

In other words, the "touches" methods don't return BOOL.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文