Cocos2D TouchesEnded not allowing me to access sprites?
        Posted  
        
            by maiko
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by maiko
        
        
        
        Published on 2010-05-15T17:35:01Z
        Indexed on 
            2010/05/15
            17:44 UTC
        
        
        Read the original article
        Hit count: 379
        
Hey Guys! Thanks so much for reading!
- (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
    UITouch * touch = [touches anyObject];
    CGPoint location = [[CCDirector sharedDirector] convertToGL: [touch locationInView:touch.view]];
    CGRect myRect = CGRectMake(100, 120, 75, 113);
    int tjx = sprite.position.x;
    if(CGRectContainsPoint(myRect, location)) {
       tjx ++;            
    }
}
For some reason, ccTouchesEnded isn't allowing me to access my "sprite". I also tried to use 
CGRectMake like so :
CGRectMake( sprite.position.x, sprite.position.y, sprite.contentSize.Width, sprite.contentSize.Height) 
But I couldn't access my sprites position or height. I keep getting "sprite" undeclared when it is declared in the init method, and added to the child.
Please help!! I'm sure i'm missing something really simple here.
© Stack Overflow or respective owner