How to move the object around the screen

Posted by Abhishek on Game Development See other posts from Game Development or by Abhishek
Published on 2011-01-10T13:00:26Z Indexed on 2011/01/10 13:59 UTC
Read the original article Hit count: 149

Filed under:

I am trying to move the object around the screen

I try this code

-(void) move
{
CGFloat upperLimit = mWinSize.height - (mGunda.contentSize.height / 2.0);
 CGFloat upperLimit1 = mWinSize.height;
 CGFloat lowerLimit = (mGunda.contentSize.height / 2.0);
CGFloat RightLimit = mWinSize.width - (mGunda.contentSize.width/2.0);
 CGFloat Right = (mGunda.contentSize.width/2.0);

if ( mImageGoingUpward ) 
 {

 mGunda.position = ccp( mGunda.position.x, mGunda.position.y + 5);

if ( mGunda.position.y >= upperLimit ) 
  {

   mImageGoingUpward = NO;
   mHori = NO;
 }
 }
 else
 {
  mGunda.position = ccp( mGunda.position.x, mGunda.position.y - 5);
if ( mGunda.position.y <= lowerLimit )
  {
   mGunda.position = ccp(mGunda.position.x +5, lowerLimit);

  }
  if(mGunda.position.x >= RightLimit) 
  {
mGunda.position = ccp(mGunda.position.x, mGunda.position.y+10);



   mHori = YES;   

 }

       if(mHori)
 {
 if(mGunda.position.y >= upperLimit)
 {
 mGunda.position = ccp(mGunda.position.x - 5,mGunda.position.y);
      }
    }  
  }   
 }
}

It move the object from bottom to top & top to bottom & bottom to right & right to right top of the screen here is problem I have got It not move to the right top to left side of screen this rotationis not happen. How can I do this

© Game Development or respective owner

Related posts about iphone