2d array initialisation

Well how about myVec.at(index).push_back(mySprite); for inserting?

And for reading

for (auto &spritesVector  : myVec)
{
      for (auto &sprite : spritesVector)
      {
        sprite->setPosition(Vec2(0, 0))
      }
}

@edvinas hey bro can you plz tell me the way to read/retrieve a 2d vector without for loop, I mean through .at() method. And if thereā€™s any explicit method for insertion then plz let me know. Any book or some document you can refer for getting deeper knowledge in the technicalities of cocos2d-x, i would be very grateful to you for this help.

@CastorTroy786

Man first of all you need to increase your c++ knowledge then try to work with cocos2d-x. You can read from vector like that myVec.at(index).at(index2)->setPosition(Vec2(0, 0)); and for inserting myVec.at(index).insert(myVec.at(index).begin() + insertIndex, mySprite);

Here is the list of c++ books c++ books list

1 Like

yeah bru i agree i donā€™t have any knowledge regarding vectorsā€¦but after all thnx a ton bruā€¦