user865881
user865881

Reputation: 17

How do I call a method with multiple parameters

hi I'm new to iOS development and i have a simple question.

I don't know how to call the following method.

-(void) ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
  {
 //do something here

 }

But when I use

[self ccTouchesBegan]

I get an error and it doesn't work. I know this is really simple question but I can't figure it out by myself

Thank you.

Upvotes: 1

Views: 233

Answers (3)

Mike Lorenz
Mike Lorenz

Reputation: 942

You don't call -ccTouchesBegan:withEvent: -- cocos2d calls it for you. What you have to do is define your own version of it to process the beginning of a touch. Read a little more introductory examples and you'll see how it's used. For instance, How To Make A Simple iPhone Game with Cocos2D uses touchesEnded, but it's the same principle.

Upvotes: 1

Rui Peres
Rui Peres

Reputation: 25917

You are missing the rest of the method. You should do something like this:

[self ccTouchesBegan:yourTouch withEvent:yourEvent];

Being yourTouch of the type (NSSet*) and yourEvent of the type (UIEvent*).

Upvotes: 0

those are delegate methods.u should not call it manually.

more over u didn't give correct arg objects to it.

u have been using cocos2d

read it and make clear

http://www.cocos2d-iphone.org/wiki/doku.php/tips:touchdelegates

Upvotes: 1

Related Questions