Question

In my game, I made many methods in GameLayer that I need to call in Level1. I'm not sure why, but I when I click start, I get this error in the console, and the game crashes.

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

followed with

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

I've uploaded GameLayer.h and .m here: http://www.4shared.com/file/O_1utrRj/undefined.html

Note: Level1 (where I call the methods) is in GameLayer.

Was it helpful?

Solution

You have written a call to a method moveBunnyM that doesn't exist. When it's effectively called, your application crashes.

What you have written however is a method moveBunnyM:(float) delta

Replace line 173:

[ptr moveBunnyM];

with

[ptr moveBunnyM:(float)dt]; 

since you call this method from a method called moveBunny that happens to take a dt parameter

This will eliminate one crash, but it shows that you have serious logic issues with your source.

Piece of advice: do not put several @implementation in the same .m file. Create several files, one per class. Level1 should be defined in Level1.h, with an import of Cocos.h, and implemented in Level1.m, with an import of Level1.h.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top