Keeping Circle inside Screen Boundary

  • Shubh2137
    Likes 0

    Problem Description

    i want to draw circle on screen and keep moving it on screen but inside screen boundary.

    im creating circle using drawDot method. and moving it by using MoveBy method.

    circle is moving but it is moving outside screen boundary even im putting following condition.

    if(pCircle->getPosition().x > Director::getInstance().getVisibleSize().width)

     

    How to do it without using PhysicsWorld.

    Thank You !

  • Sonar Systems admin
    Likes 0

    Does that line of code stop it at all?

  • Shubh2137
    Likes 0

    No..sad

  • Sonar Systems admin
    Likes 0

    Try printing out the x position values to the console and see if it is changing as expected.

Login to reply