Wall* Wall::create(Field* field, const Grid &pos) { Wall* wall = new Wall(); if (wall && wall->initWithGrid(field, "rWall_0003", pos)) { wall->autorelease(); wall->retain(); } else { CC_SAFE_DELETE(wall); wall = nullptr; } wall->_is_top_wall_exist = wall->_isWallExist(wall->m_grid_pos + Grid(0, -1)); wall->_is_right_wall_exist = wall->_isWallExist(wall->m_grid_pos + Grid(1, 0)); wall->_refreshWall(); auto left_wall = wall->_getWall(wall->m_grid_pos + Grid(-1, 0)); if (left_wall) { left_wall->notifyRightWallExist(); } auto bottom_wall = wall->_getWall(wall->m_grid_pos + Grid(0, 1)); if (bottom_wall) { bottom_wall->notifyTopWallExist(); } return wall; }
Wall* Wall::create(int id) { Wall *pRet = new Wall(id); if (pRet && pRet->init()) { pRet->autorelease(); return pRet; } else { delete pRet; pRet = NULL; return NULL; } }
Wall* Wall::create(ValueMap& model) { Wall *pRet = new Wall(model); if (pRet && pRet->init()) { pRet->autorelease(); return pRet; } else { delete pRet; pRet = NULL; return NULL; } }
Wall* Wall::create(const Size& size,const PhysicsMaterial& pm ) { Wall* wall = new (std::nothrow) Wall; if (wall && wall->init()) { wall->initBody(size,pm); wall->autorelease(); return wall; } else { CC_SAFE_DELETE(wall); return nullptr; } }
Wall* Wall::create(const std::string & filename) { Wall* pSprite = new Wall(); if (pSprite->initWithFile(filename)) { pSprite->autorelease(); pSprite->initOptions(); return pSprite; } CC_SAFE_DELETE(pSprite); return NULL; }