How to move the object around the screen
- by Abhishek
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