-1

在我的游戏中,我在 GameLayer 中创建了许多需要在 Level1 中调用的方法。我不知道为什么,但是当我单击开始时,我在控制台中收到此错误,并且游戏崩溃了。

Assertion failure in -[CCTimer initWithTarget:selector:interval:]

其次是

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Signature not found for selector - does it have the following form? -(void) name: (ccTime) dt'

我在这里上传了 GameLayer.h 和 .m:http ://www.4shared.com/file/O_1utrRj/undefined.html

注意:Level1(我称之为方法)在 GameLayer 中。

4

1 回答 1

1

您编写了对不存在的方法 moveBunnyM 的调用。当它被有效调用时,您的应用程序崩溃。

然而你写是一个方法 moveBunnyM:(float) delta

替换第 173 行:

[ptr moveBunnyM];

[ptr moveBunnyM:(float)dt]; 

因为您从一个名为 moveBunny 的方法调用此方法,该方法恰好采用 dt 参数

这将消除一次崩溃,但它表明您的源代码存在严重的逻辑问题。

一条建议:不要将多个 @implementation 放在同一个 .m 文件中。创建多个文件,每个类一个。Level1 应该在 Level1.h 中定义,并导入 Cocos.h,并在 Level1.m 中实现,并导入 Level1.h。

于 2011-09-02T23:27:00.083 回答