Quantcast
Channel: Cocos Forums - Latest topics
Viewing all articles
Browse latest Browse all 17075

Help with my vector

$
0
0

@Hamlet wrote:

hello i have problem for display the sprite in my app ,the framework say build successfull but dont show the sprite (Signal1)

auto backgrounddisplay=Sprite::createWithSpriteFrameName("backgrounddisplay.png");
backgrounddisplay->setPosition(Vec2(visibleSize.width/2 +origin.x, visibleSize.height/2+origin.y));
layer->addChild(backgrounddisplay,-2);

auto frontdisplay=Sprite::createWithSpriteFrameName("frontdisplay.png");
frontdisplay->setPosition(Vec2(visibleSize.width/2 +origin.x, visibleSize.height/2+origin.y));
layer->addChild(frontdisplay,2);

// Position of Codes
Vec2 firstposition = Vec2(frontdisplay->getPositionX()- frontdisplay->getContentSize().width/-2.5,
frontdisplay->getPositionY()+frontdisplay->getContentSize().height/-26);

Vec2 secondposition = Vec2(frontdisplay->getPositionX()- frontdisplay->getContentSize().width/-4.1,
frontdisplay->getPositionY()+frontdisplay->getContentSize().height/-26);

Vec2 thirdposition = Vec2(frontdisplay->getPositionX()- frontdisplay->getContentSize().width/-11.8,
frontdisplay->getPositionY()+frontdisplay->getContentSize().height/-26);

Vec2 fourthposition = Vec2(frontdisplay->getPositionX()-frontdisplay->getContentSize().width/11.7,
frontdisplay->getPositionY()+ frontdisplay->getContentSize().height/-26);

Vec2 fifthposition = Vec2(frontdisplay->getPositionX()-frontdisplay->getContentSize().width/4.1,
frontdisplay->getPositionY()+ frontdisplay->getContentSize().height/-26);
Vec2 sixthposition = Vec2(frontdisplay->getPositionX()-frontdisplay->getContentSize().width/2.5,
frontdisplay->getPositionY()+ frontdisplay->getContentSize().height/-26);

Vec2 positions[6];
positions[0] = firstposition;
positions[1] = secondposition;
positions[2] = thirdposition;
positions[3] = fourthposition;
positions[4] = fifthposition;
positions[5] = sixthposition;
this->_positions;

std::vector_positions(6);

auto Signal1=Sprite::createWithSpriteFrameName("signal1.png");
Signal1->setTag(0);
this->_positions.pushBack(Signal1);
std::cout<<_positions[0]<<std::endl;

someone can help me in this part please

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 17075

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>