Duck
Duck

Reputation: 35943

Cocos2d 2.0 - Creating buttons that can be selected at the same time

I am new to Cocos2d.

I need to create something that is a bunch of buttons that can be selected at the same time.

Imagine a piano keyboard. If you press on a key, it highlights. If you press between two keys, both highlight. If you use two fingers and your finger touches 4 keys, all keys highlight. You got the idea of what I need.

I am following this tutorial http://www.raywenderlich.com/414/how-to-create-buttons-in-cocos2d-simple-radio-and-toggle

But as far as I read, you have always to create a CCMenu and put all buttons there. But as far as I read and tested, CCMenu will just allow one button selected at a time. What is the best way to create elements that can be tapped at the same time in any number?

Upvotes: 0

Views: 809

Answers (2)

Ben Trengrove
Ben Trengrove

Reputation: 8729

Ensure that in your App Delegate you have the following line

[glView setMultipleTouchEnabled:YES];

With seperate CCMenu's you can multitouch both of them, I just tested in the latest version of Cocos2d 2.0 from git.

Upvotes: 3

Andres C
Andres C

Reputation: 929

In my experience, i have resorted to creating various CCMenus with a button each.

Upvotes: 1

Related Questions