Hello,
I want to add page curl effect to a book sprite is it possible to achieve in cocos2d-X?
I want the output like this
Thanks
Hello,
I want to add page curl effect to a book sprite is it possible to achieve in cocos2d-X?
I want the output like this
Thanks
I dont think you will be able to handle that by touch as shown in video but cocos has one Action called PageTurn3D
You can check in cpp-test => Effects - Basic
I don’t think that’s quite right, since you can keep track of where you are touching the screen and update the relevant coordinates in your page turn algorithm by using onTouchMoved. For instance:
auto listener = EventListenerTouchOneByOne::create();
listener->onTouchBegan = [this](Touch* touch, Event* event) {
auto location = touch->getLocation();
// do what you want here
return true;
};
listener->onTouchMoved = [this](Touch* touch, Event* event) {
auto location = touch->getLocation();
// do what you want here while your finger is moving on the screen, the
// location is being updated and this method is constantly getting called
return true;
};
listener->onTouchEnded = [this](Touch* touch, Event* event) {
auto location = touch->getLocation();
// do what you want here
return true;
};
If the PageTurn3D class in Cocos2d-x isn’t suitable for you, then here is some information and code you can go through to understand how to implement it yourself. Porting this implementation over to Cocos2d-x shouldn’t be too tough: