bool FavoriteScene::init(){ if (GameLayerBase::initWithBgFileName("make/bg_favorite1136.jpg", false)) { Sprite* title = Sprite::create("ui/share/font_favorite_recipe.png"); title->setPosition(Vec2(STVisibleRect::getCenterOfScene().x, STVisibleRect::getPointOfSceneLeftUp().y - 100) + Vec2(-STVisibleRect::getGlvisibleSize().width, 0)); addChild(title); title->runAction(Sequence::create(DelayTime::create(1.0), EaseElasticInOut::create(MoveBy::create(1.5, Vec2(STVisibleRect::getGlvisibleSize().width, 0)), 1.2), NULL)); addScrollview(); showPreviousBtn(2.0f); return true; } return false; }
bool DecorateScene::init(){ if (GameLayerBase::initWithBgFileName("make/bg_make_table_cover.png")) { allItems.bgName = "make/bg_make_table_cover.png"; DataContainer::FlavorInfor info = DataContainer::getInstance()->getTheFlavorByName(DataContainer::getInstance()->getChooseFlavor()); Sprite* bg2 = Sprite::create("make/bg/tablebg_"+info.name+".png"); bg2->setPosition(STVisibleRect::getCenterOfScene() + Vec2(0, 120)); addChild(bg2, -1); cannotEatLayer = Layer::create(); cannotEatLayer->setContentSize(STVisibleRect::getGlvisibleSize()); cannotEatLayer->setPosition(STVisibleRect::getOriginalPoint()); addChild(cannotEatLayer, 1); canEatLayer = Layer::create(); canEatLayer->setContentSize(STVisibleRect::getGlvisibleSize()); canEatLayer->setPosition(STVisibleRect::getOriginalPoint()); addChild(canEatLayer, 8); Sprite* table = Sprite::create("make/bg_make_table_table.png"); table->setAnchorPoint(Vec2(0.5, 0)); table->setPosition(Vec2(STVisibleRect::getCenterOfScene().x, STVisibleRect::getOriginalPoint().y)); cannotEatLayer->addChild(table, 1); tableMaxy = table->getBoundingBox().getMaxY(); Sprite* bowl1 = Sprite::create("make/bowl_1.png"); Sprite* bowl2 = Sprite::create("make/bowl.png"); bowl1->setPosition(STVisibleRect::getCenterOfScene().x, tableMaxy - 180); bowl2->setPosition(bowl1->getPosition()); this->addChild(bowl1, 6); this->addChild(bowl2, 3); string flavor = DataContainer::getInstance()->getChooseFlavor(); flavorinBowl = Sprite::create("make/cereals_stir/"+flavor+"_1.png"); flavorinBowl->setPosition(bowl1->getPosition()); flavorinBowl->setName(flavor); addChild(flavorinBowl, 5); addFixedThings(); addScrollView(); showNextButton(2.0f, false); showPreviousBtn(2.0f); showResetBtn(2.5f); return true; } return false; }