Hello @nite
I use cocos2dx v3.4 and Cocos Studio v2.1.2 beta and choose binary format for exproting.
After few days of researching I realized that there is actualy no matter what type of file you create in Studio (Scene, Layer or Node).
All these files will be loaded the same way and root node will be loaded as base Node object.
Also I looked throgh NodeReader::setPropsWithFlatBuffers()
and NodeReader::setLayoutComponentPropsWithFlatBuffers()
and saw that percentage size/position will not be applied to the root node. The only default values is applied. Moreover when I run the scene in the Simulator (included in Studio) this scene works correctly and the root node get fullscreen size. Seems like the simulator loads scenes in a different way. I just need to get the simple thing - the root node of the loaded scene would get fullscreen size on different screen resolutions and all the children would be positioned in compliance with their layouts.
Does anybody know where Armature went on cocostudio 2.0.6?
Iām pretty sure that I saw it on 1.x over internet.
No. Maybe it was just working with older versions. Iām not using CS2.x but CS1.x
Just do this:
auto bee = rootNode->getChildByName("bee_1")->getChildByName("Sprite_2")
cocostudio::timeline::ActionTimeline *timelineBee = CSLoader::createTimeline("Bee1.csb");
bee->runAction(timelineBee);
timelineBee->gotoFrameAndPlay(0, true);
auto bee_2 = rootNode->getChildByName("bee_2")->getChildByName("bee_2");
cocostudio::timeline::ActionTimeline *timelineBee2 = CSLoader::createTimeline("Node.csb");
bee_2->runAction(timelineBee2);
timelineBee2->gotoFrameAndPlay(0, true);
You have to do this, cause you attached āNode.csbā to your bee_2 node.
@nite or other cocos2dx dev, are there any plans to add easing (ease in/ease out) for animations in cocostudio in the near future? thanks
Is it possible to take a look at your Node file?
Sure @nite
http://bit.ly/19Kd8CD
I try to load SmallWindow.csb
Update. The code for file loading:
Node * node = CSLoader::getInstance()->createNodeWithFlatBuffersFile("SmallWindow.csb");
Scene * scene = Scene::create();
Director::getInstance()->runWithScene(scene);
scene->addChild(node);
return true;
Guys, I exported star.plist from particle editor for cocos2d and import it in Cocos Studio 2.1.2 beta.
I add particle in MainScene.csd and reset the file .plist with start.plist.
It gets error.
Is there something wrong I did?
no problem I get it now.
I forgot to add the texture/image used in particle editor in Cocos Studio 2.1.2
Problem solved. Ty, Ty.
Hi, i wish to know how to do 2 things:
I want to know how to get a touch of a node which is an animation, I have this but it dont work:
coche1 = CSLoader::createNode("../res/CocheRojo2.csb");
addChild(coche1,2,kTagCoche1);
if (coche1->boundingBox().containsPoint(touchLocation)) //it dont work
CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect(āSonidos/coche1.wavā);
And the other thing, I tried to add audio in cocostudio and I want to play it like in older versions of cocostudio, like this:
CCComAudio *pAudio = (CCComAudio*)(pNode->getComponent("Audio"));
pAudio->playBackgroundMusic(pAudio->getFile(), pAudio->isLoop());
how to do this in 2.1 version?
If anybody is looking for a good armature tutorial (and the only one Iāve found), look at this:
http://cn.cocos2d-x.org/tutorial/show?id=2187
I hope it will be helpfull
Did you setup a listener on the animated node, you want to get touches for?
Did you remap the coordinates?
Did you attach the listener to the node?
E,g,:
listener->onTouchBegan = [&](Touch* touch, Event* event)
{
Sprite* currentTarget = static_cast<Sprite*>(event->getCurrentTarget());
// Get the position of the current point relative to the button
Point locationInNode = currentTarget->convertToNodeSpace(touch->getLocation());
Size s = currentTarget->getContentSize();
Rect rect = Rect(0, 0, s.width, s.height);
//Check the click area
if (!rect.containsPoint(locationInNode))
{
return false;
}
// Do some touch magic here
return true;
};
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, coche1);
@panor
have u add this one to your code:
FileUtils::getInstance()->addSearchPath(āresā);
FileUtils::getInstance()->addSearchPath(āSonidosā);
for this one:
coche1 = CSLoader::createNode(āres/CocheRojo2.csbā);
CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect(āSonidos/coche1.wavā);
Hello guys.
I have added cocos studio scene 2.1 in my codes.
I played its timeline.
auto node = CSLoader::createNode("res/MainScene.csb"); this->addChild(node);
auto redSun = CSLoader::createTimeline("res/SunRed_node.csb"); node->runAction(redSun); redSun->gotoFrameAndPlay(0, true);
What I want is how to make this file (MainScene.csb) disappear after it is done playing animation?
And how to know if the animation is already done?
You can set a callback function with the timelineās setLastFrameCallFunc
function and remove the timeline and the node in there,
Ty for fast reply, @iQD
But can you give me an example of how to do it?
I didnāt see any example in cpptests.
Sure:
redSun->setLastFrameCallFunc([&]() { removeChild(node); });
redSun is removed automatically by the engine, as it is an auto-release object.