1
vote
3answers
129 views

Getting different x and y coordinates for touched location on a zoomed view

I'm using Cocos2d for developing a game. I need to be able to pan and zoom when necessary, so for this reason I've added CCLayerPanZoom extension to my project. Recently I've noticed a problem with ...
0
votes
1answer
83 views

How to use UILongPressGestureRecognizer with sprite drag & wait?

May be it's asked before also but I couldn't find any good answer. Please tell me how this can be implemented with UILongPressGestureRecognizer? A user drags a sprite from X location to Y location. ...
1
vote
0answers
71 views

UITapGestureRecognizer fast tapping not working [closed]

I have initialized UITapGesture as follows: tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)]; tapGestureRecognizer.numberOfTapsRequired = ...
0
votes
1answer
286 views

Touching a CGRect

In my cocos2d app I am trying to determine when a CCSprite is touched Here is what I have: -(BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event{ NSMutableArray *targetsToDelete = ...
1
vote
2answers
793 views

Basic game architechture best practices in Cocos2D on iOS

Consider the following simple game: 20 squares floating around an iPhone's screen. Tapping a square causes that square to disappear. What's the "best practices" way to set this up in Cocos2D? Here's ...
7
votes
2answers
2k views

How to differentiate a tap from a drag

I'm creating an app and I'm trying to make it so I can drag a sprite (with a second sprite on top) around the screen, but if I just tap the sprite some other method should get called. I got the ...
0
votes
1answer
387 views

Where does touch control logic go?

I'm creating a game (or app, depending on how you would define it...) where I'm moving objects (with sprites) on the screen. I've got this to half-work in both scenarios, but I can't seem to get it ...
0
votes
0answers
219 views

detect sprites by tag in parallax

I've created 3 layers and added to a parallax node in my game play scene; I don't know why it crashes when I'm enabling touch, self.isTouchEnabled = YES; on one of my layers; I want that touch to be ...
1
vote
1answer
568 views

How can I scroll sprites when swiping using Cocos2D?

I'm adding 3 sprites (layers) to CCParallaxNode: BGLayer = [CCSprite spriteWithFile:@"Layer.png"]; [_backgroundNode addChild:BGLayer z:2 parallaxRatio:layer1Speed ...
1
vote
1answer
596 views

Retrieving latest touch to interrupt another

In Cocos2D for iPhone, I want the latest touch event to interrupt another and ignore the last touch. Let me know if I need to elaborate more, but basically my game consists of a lot of finger ...