How can I make my pause menu appear when there is a 3-finger click ?
3 fingers detection.
(21 posts) (7 voices)-
Posted 1 year ago #
-
3 fingers would is not pause. 3 fingers would swiping through pages.
Apart from not knowing how to implement it, I think you should be very careful of trying to teach apple users new tricks.Posted 1 year ago # -
Then what should I use to get to the pause menu?
If the user clicks everywhere on the screen very fast ...
Right now, the pause button is often touched by error.
Posted 1 year ago # -
Most games have a button somewhere, with the two vertical bars representing that pause.
Posted 1 year ago # -
I don't think it's a bad approach to use 3 fingers to pause. That's the way Osmos is doing it.
Posted 1 year ago # -
Well, I think I would at least TRY the 3 fingers touch to pause ...
But anyone has any idea on how to implement it ?
Posted 1 year ago # -
It would be nice to know what you've tried first so we don't give you answers that you've already tried.
Was there an idea that you had or did you try some code in the documentation or another forum that did not work?
Do you have a small sample of that code? Maybe there's just a logic error or maybe you didn't register for multi touch correctly.
Posted 1 year ago # -
I haven't done it but I'm guessing you could implement the standard touch delegate and keep track on the touches count in the NSSet like this [[touches allObjects] count]
http://www.cocos2d-iphone.org/wiki/doku.php/tips:touchdelegates?s=touches
Posted 1 year ago # -
Who is Osmos?
Posted 1 year ago # -
Google suggests http://www.hemispheregames.com/osmos/
Posted 1 year ago # -
I changed my mind.
I think it would be better to have 2 pause buttons and to go in the pause menu only when the 2 are simultaneously pressed.
How could I possibly do that?
P.S. And I tried this to get the 3 finger tap to work but it said touches was undeclared:
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { if ([touches count] == 3) { //etc } }Posted 1 year ago # -
Try [[touches allObjects] count] instead of [touches count] in the if statement.
Posted 1 year ago # -
Sure, but you switched from Touches to Touch, so your first parameter is no longer an NSSet...
Posted 1 year ago # -
Yeah I changed it!
I noticed before I saw your post though :D
Now I don't get compiler warnings !
Thank you ruben301 !
And Benihana!
Hey, still doesn't work ...
Here's my code:
-(void) touchesEnded:(NSSet *)touch withEvent:(UIEvent *)event{ if ([[touch allObjects] count] == 3) { NSLog(@"Yeah!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); } }Posted 1 year ago # -
Maybe I didn't do the enableMultiTouch thing...
where am I supposed to write this ?
Posted 1 year ago # -
You may not get all three touches ending at one.
Try
[[event touchesInView:[[touch anyObject] view]] count]... (Off the top of my head, you'll need to check the docs for NSSet, UITouch and UIEvent to get the exact commands, if that doesn't work)I'd suggest renaming
touchtotouches, that'll get confusing later.Edit: http://www.cocos2d-iphone.org/wiki/doku.php/tips:touchdelegates?s=touch#multi_touch
Posted 1 year ago # -
@TBBle
Thanks ! Didn't have this in my app delegate!Think it would work if I add 1 to an integer in cctouchbegan and substract one to the same integer in cctouchended, so when the integer is 3, it counts as 3 fingers on the screen simultaneously? Does it work that way?
I'll try this ...
Posted 1 year ago # -
Yeah! it worked!
For anyone that wants to know my code:
First i declared my integer:
int fingerNb;-(BOOL) ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event{ //adding 1 to fingerNb, because a new finger is touching the screen fingerNb++; if (fingerNb == 3) { // and blablabla ... some coding } return YES; } -(void) ccTouchEnded:(UITouch *)touch withEvent:(UIEvent *)event{ // remove 1 to fingerNb, because there is one less finger on the screen fingerNb--; }But with this method, 4 fingers are still triggering the 3 finger IF.
Posted 1 year ago # -
Posted 1 year ago #
Reply
You must log in to post.