title: iPhone, Cocos2D - moving sprite left/right while touching screen
body: <p>I'm new to Objective C and app development so please go easy on me!
  I'm trying to make a basic game and need to move a sprite left or right continuously while the user's finger is on the screen - left side to go left, right to go right...
  I'm trying to use update to repeat movements of a few pixels every 1/60th second. So far, this is what I have (and sorry about the formatting):</p>
  
  <pre><code>    #import "GameplayLayer.h"
  
      @implementation GameplayLayer
  
      -(id)init {
           self = [super init];
           if (self != nil) {
           CGSize screenSize = [CCDirector sharedDirector].winSize;  
            // enable touches
           self.isTouchEnabled = YES;  
  
       blobSprite = [CCSprite spriteWithFile:@"blob.png"];
      [blobSprite setPosition: CGPointMake(screenSize.width/2, screenSize.height*0.17f)];
  
      ball = [CCSprite spriteWithFile:@"ball.png"];
      [ball setPosition:CGPointMake(10, screenSize.height*0.75f)];
  
      [self addChild:blobSprite];  
      [self addChild:ball];
  
      [self schedule:@selector(update) interval:1.0f/60.0f];
  
     }
     return self;
   }
  
  
  
      -(void) update:(ccTime)dt{
        if (_tapDownLeft == YES){
           blobSprite.position.x==blobSprite.position.x-5;
        }
       if (_tapDownRight == YES){
           blobSprite.position.x==blobSprite.position.x+5;
       }
      }
  
  
  -(void) ccTouchesBegan:(UITouch*)touch withEvent: (UIEvent *)event{
  
   CGPoint touchLocation = [touch locationInView:[touch view]];
   touchLocation = [[CCDirector sharedDirector] convertToGL:touchLocation];
  
  if (touchLocation.x &gt; 400) {
     if ((blobSprite.position.x+10)&lt;460){
             _tapDownRight = YES;
        }
  }
  
  if (touchLocation.x &lt; 200) {
      if ((blobSprite.position.x-10&gt;20)){
             _tapDownLeft = YES;
        } 
  }
  
  else {
      _tapDownLeft = NO;
      _tapDownRight = NO; 
        }   
  }
   -(void)ccTouchEnded:(UITouch *)touch withEvent:(UIEvent *)event{
        _tapDownLeft = NO;
        _tapDownRight = NO;
        }
  
  
  
  -(void) registerWithTouchDispatcher{
    [[CCTouchDispatcher sharedDispatcher]addTargetedDelegate:self priority:0                            swallowsTouches:YES];
  }
  
  
  @end
  </code></pre>
  
  <p>Am I on the right lines with this? At the moment it's giving me 'expression result unused' in update. Could anyone tell me what I'm missing? Any help would be greatly appreciated.</p>
  
  <p>Thanks,
  Patrick</p>