Problem when i try to run an action

I have a sprite in my scene, i need to add a action, but the problem is that i have a error when i try to run in visual studio. The problem is in the action but i don’t know what is wrong.

Sprite* sprite = Sprite::create("bg.png");
sprite->setPosition(Point(visibleSize.width / 2 + origin.x, visibleSize.height / 2 + origin.y));
addChild(sprite, 1);

// THE PROBLEM IS HERE
    sprite->runAction(FadeOutDownTiles::create(1, Size(32, 24)));

It is in Spanish, so I’ll try to translate:

Problem in Spanish:
Primera excepción en 0x64EC3BEC (libcocos2d_2013.dll) en MyGame.exe: 0xC0000005: Infracción de acceso al leer la ubicación 0x00000310.
Excepción no controlada en 0x64EC3BEC (libcocos2d_2013.dll) en MyGame.exe: 0xC0000005: Infracción de acceso al leer la ubicación 0x00000310.

Problem in English:

First exception in 0x64EC3BEC  (libcocos2d_2013.dll) in MyGame.exe: 0xC0000005: Access violation reading location 0x00000310 the.

Unhandled exception in 0x64EC3BEC (libcocos2d_2013.dll) in MyGame.exe: 0xC0000005: Access violation reading location 0x00000310 the.

I need help…

and sprite is not null, correct?

@slackmoehrle it is not.

When I try to run this code (and replacing the name of the sprite with one I have), I get this:

Assert failed: GridActions can only used on NodeGrid
Assertion failed: (_gridNodeTarget), function cacheTargetAsGridNode, file /Users/nhnzim008/Downloads/cocos2d-x-3.8/projects/TestApp/cocos2d/cocos/2d/CCActionGrid.cpp, line 84.

So I think maybe you can’t use FadeOutDownTiles with a sprite? I am unsure how grids work in Cocos2d, but maybe you need to create one and add your sprite to it?

I figured out a way to make it work, but you may still need to look into grids to find out the best way to use this. Try this:

Sprite* sprite = Sprite::create("bg.png");
sprite->setPosition(Point(visibleSize.width / 2 + origin.x, visibleSize.height / 2 + origin.y));
    
NodeGrid* grid = NodeGrid::create();
addChild(grid);
    
grid->addChild(sprite);
   
grid->runAction(FadeOutDownTiles::create(1, Size(32, 24)));

@grimfate Thank you very much, works perfect, but I’ll have to investigate further because it also gives me the problem following the code of the wiki cocos2d-x. http://cocos2d-x.org/wiki/Effects