void HelloWorld::addEndLine(){ auto b = EndLine::createWithContext(this); b->setLineIndex(4); b->setPositionY(b->getLineIndex()*visibleSize.height/4); gameLayer->addChild(b); currentEndLine = b; }
bool Block::initWithArgs(Color3B bg, Size size, int lineIndex) { Sprite::init(); setColor(bg); setContentSize(size); setAnchorPoint(Point::ZERO); setTextureRect(Rect(1, 1, size.width-2, size.height-2)); setLineIndex(lineIndex); return true; }
void HelloWorld::addStartLine(){ auto b = Block::createWithArgs(Color3B::YELLOW, Size(visibleSize.width, visibleSize.height/4), "", 20, Color4B::BLACK); gameLayer->addChild(b); b->setLineIndex(0); }
void HelloWorld::addEndLine(){ auto b = Block::createWithArgs(Color3B::GREEN, visibleSize, "Game Over", 32, Color4B::BLACK); gameLayer->addChild(b); b->setLineIndex(4); }