Cocos2dx C++ changing sprite image dynamically.

  • shahid
    Likes 0

    Problem Description

    I am creating a sprite with texture 2d object like this:

    auto sprite = cocos2d::Sprite::createWithTexture(result);

    now i want to change the sprite to a new texture 2d object. How do i do it?

    solved:-

    This method itself replaces the texture when its called with a new texture 2d object


  • Sonar Systems admin
    Likes 0

    use the setTexture method so like this:

     

    sprite->setTexture( texture );

Login to reply