I am using cocos2d-x 3.7 with physics in c++. on touch event i make sprite jump it working fine but when I touched multiple time it move out of physics world
so please hemp me to figure out this issue.
Next time pls show some code.
But if I have to guess you have to add a wall at the boundaries you can see in cosos2d-cpp tests
Physics.cpp how this is done for example:
auto wall = Node::create();
wall->setPhysicsBody(PhysicsBody::createEdgeBox(VisibleRect::getVisibleRect().size, PhysicsMaterial(0.1f, 1, 0.0f)));
wall->setPosition(VisibleRect::center());
root->addChild(wall);
Thanks for reply.
I had solved it by putting condition as if sprite is in same position at y-axis then only jump To() method called
if(hero->getPosition().y == heroPosition.y)
{
auto jump = JumpTo::create(1, Vec2(hero->getPositionX(), heroPosition.y), 100, 1);
hero->runAction(jump);
}