简体   繁体   English

LevelHelper碰撞不起作用

[英]LevelHelper collision not working

This problem has stumped me for two nights now, I cannot simply have two LHSprites collide with each other using level helper collision . 这个问题现在让我困扰了两个晚上,我不能简单地使两个LHSprites collide使用level helper collisionLHSprites collide level helper collision I have checked the docs multiple times to check if I was missing something, but i cannot see it. 我已经多次检查了文档 ,以检查是否缺少某些东西,但是我看不到它。

In the console of xCode, it logs: 在xCode的控制台中,它记录:

 LevelHelper WARNING: Please call useLevelHelperCollisionHandling after addObjectsToWorld
2013-04-24 20:33:04.537 Monkeys2D[1322:c07]
 LevelHelper WARNING: Please call registerPostCollisionCallbackBetweenTagA after useLevelHelperCollisionHandling

But as you can see in my code below, I am correctly doing what it is warning me that I am not. 但是正如您在下面的代码中看到的那样,我正在正确地执行警告我不是的警告。

-(id) init
{
if( (self=[super init])) {

    self.isTouchEnabled = YES;

    loader = [[LevelHelperLoader alloc]initWithContentOfFile:@"Level1"];

    [loader addObjectsToWorld:world cocos2dLayer:self];

    [loader useLevelHelperCollisionHandling];

    [loader registerPostCollisionCallbackBetweenTagA:MONKEY andTagB:SINGLEBANANA idListener:self selListener:@selector(collision)];

}
return self;
}

My problem is that the collision will NOT register, it acts as if nothing is even happening when the MONKEY and the SINGLEBANANA collide. 我的问题是,冲突不会记录下来,它的作用就好像在MONKEYSINGLEBANANA碰撞时什么也没有发生。

Any help would be greatly appreciated! 任何帮助将不胜感激!

原来我需要添加一个update方法并实现一些其他box2d的东西,请访问级别帮助器文档和论坛以进行查看。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM