I’ve got a strange error that brakes my game. And I spent two day trying to found out the reason of it. Here is code that generates error. The main reason why I can not figure out myself is that it game can breaks or at first circle, or at second, or work for 5 minutes without errors.
I tried to catch error using eclipse + logcat. But there were no errors.
Appreciate any help
void MainScene::startGame()
{
this->block = BlockObject::create(48);
this->block->setPosition(200, 300);
this->block_exists = true;
this->schedule(schedule_selector(MainScene::autoMoveBlockDown),0.2);
}
void MainScene::autoMoveBlockDown(float dt)
{
if(this->block_exists)
{
this->removeChild(this->block);
this->block_exists = false;
}
else
{
this->block = BlockObject::create(48);
this->block->setPosition(200, 300);
this->addChild(this->block, 20, TAG::BLOCK);
this->block_exists = true;
}
}