void CCJumpTiles3D::update(float time) { int i, j; float sinz = (sinf((float)M_PI * time * m_nJumps * 2) * m_fAmplitude * m_fAmplitudeRate ); float sinz2 = (sinf((float)M_PI * (time * m_nJumps * 2 + 1)) * m_fAmplitude * m_fAmplitudeRate ); for( i = 0; i < m_sGridSize.width; i++ ) { for( j = 0; j < m_sGridSize.height; j++ ) { ccQuad3 coords = originalTile(ccp(i, j)); if ( ((i+j) % 2) == 0 ) { coords.bl.z += sinz; coords.br.z += sinz; coords.tl.z += sinz; coords.tr.z += sinz; } else { coords.bl.z += sinz2; coords.br.z += sinz2; coords.tl.z += sinz2; coords.tr.z += sinz2; } setTile(ccp(i, j), coords); } } }
void CCShakyTiles3D::update(cocos2d::ccTime time) { int i, j; for (i = 0; i < m_sGridSize.x; ++i) { for (j = 0; j < m_sGridSize.y; ++j) { ccQuad3 coords = originalTile(ccg(i, j)); // X coords.bl.x += ( rand() % (m_nRandrange*2) ) - m_nRandrange; coords.br.x += ( rand() % (m_nRandrange*2) ) - m_nRandrange; coords.tl.x += ( rand() % (m_nRandrange*2) ) - m_nRandrange; coords.tr.x += ( rand() % (m_nRandrange*2) ) - m_nRandrange; // Y coords.bl.y += ( rand() % (m_nRandrange*2) ) - m_nRandrange; coords.br.y += ( rand() % (m_nRandrange*2) ) - m_nRandrange; coords.tl.y += ( rand() % (m_nRandrange*2) ) - m_nRandrange; coords.tr.y += ( rand() % (m_nRandrange*2) ) - m_nRandrange; if (m_bShakeZ) { coords.bl.z += ( rand() % (m_nRandrange*2) ) - m_nRandrange; coords.br.z += ( rand() % (m_nRandrange*2) ) - m_nRandrange; coords.tl.z += ( rand() % (m_nRandrange*2) ) - m_nRandrange; coords.tr.z += ( rand() % (m_nRandrange*2) ) - m_nRandrange; } setTile(ccg(i, j), coords); } } }
void CCShakyTiles3D::update(float time) { CC_UNUSED_PARAM(time); int i, j; for (i = 0; i < m_sGridSize.width; ++i) { for (j = 0; j < m_sGridSize.height; ++j) { ccQuad3 coords = originalTile(ccp(i, j)); // X coords.bl.x += ( rand() % (m_nRandrange*2) ) - m_nRandrange; coords.br.x += ( rand() % (m_nRandrange*2) ) - m_nRandrange; coords.tl.x += ( rand() % (m_nRandrange*2) ) - m_nRandrange; coords.tr.x += ( rand() % (m_nRandrange*2) ) - m_nRandrange; // Y coords.bl.y += ( rand() % (m_nRandrange*2) ) - m_nRandrange; coords.br.y += ( rand() % (m_nRandrange*2) ) - m_nRandrange; coords.tl.y += ( rand() % (m_nRandrange*2) ) - m_nRandrange; coords.tr.y += ( rand() % (m_nRandrange*2) ) - m_nRandrange; if (m_bShakeZ) { coords.bl.z += ( rand() % (m_nRandrange*2) ) - m_nRandrange; coords.br.z += ( rand() % (m_nRandrange*2) ) - m_nRandrange; coords.tl.z += ( rand() % (m_nRandrange*2) ) - m_nRandrange; coords.tr.z += ( rand() % (m_nRandrange*2) ) - m_nRandrange; } setTile(ccp(i, j), coords); } } }
void CCFadeOutUpTiles::transformTile(const CCPoint& pos, float distance) { ccQuad3 coords = originalTile(pos); CCPoint step = m_pTarget->getGrid()->getStep(); coords.bl.y += (step.y / 2) * (1.0f - distance); coords.br.y += (step.y / 2) * (1.0f - distance); coords.tl.y -= (step.y / 2) * (1.0f - distance); coords.tr.y -= (step.y / 2) * (1.0f - distance); setTile(pos, coords); }
void CCFadeOutTRTiles::transformTile(cocos2d::ccGridSize pos, float distance) { ccQuad3 coords = originalTile(pos); CCPoint step = m_pTarget->getGrid()->getStep(); coords.bl.x += (step.x / 2) * (1.0f - distance); coords.bl.y += (step.y / 2) * (1.0f - distance); coords.br.x -= (step.x / 2) * (1.0f - distance); coords.br.y += (step.y / 2) * (1.0f - distance); coords.tl.x += (step.x / 2) * (1.0f - distance); coords.tl.y -= (step.y / 2) * (1.0f - distance); coords.tr.x -= (step.x / 2) * (1.0f - distance); coords.tr.y -= (step.y / 2) * (1.0f - distance); setTile(pos, coords); }
void CCShuffleTiles::placeTile(const CCPoint& pos, Tile *t) { ccQuad3 coords = originalTile(pos); CCPoint step = m_pTarget->getGrid()->getStep(); coords.bl.x += (int)(t->position.x * step.x); coords.bl.y += (int)(t->position.y * step.y); coords.br.x += (int)(t->position.x * step.x); coords.br.y += (int)(t->position.y * step.y); coords.tl.x += (int)(t->position.x * step.x); coords.tl.y += (int)(t->position.y * step.y); coords.tr.x += (int)(t->position.x * step.x); coords.tr.y += (int)(t->position.y * step.y); setTile(pos, coords); }
void CCWavesTiles3D::update(float time) { int i, j; for( i = 0; i < m_sGridSize.width; i++ ) { for( j = 0; j < m_sGridSize.height; j++ ) { ccQuad3 coords = originalTile(ccp(i, j)); coords.bl.z = (sinf(time * (float)M_PI *m_nWaves * 2 + (coords.bl.y+coords.bl.x) * .01f) * m_fAmplitude * m_fAmplitudeRate ); coords.br.z = coords.bl.z; coords.tl.z = coords.bl.z; coords.tr.z = coords.bl.z; setTile(ccp(i, j), coords); } } }
void CCWavesTiles3D::update(cocos2d::ccTime time) { int i, j; for( i = 0; i < m_sGridSize.x; i++ ) { for( j = 0; j < m_sGridSize.y; j++ ) { ccQuad3 coords = originalTile(ccg(i, j)); coords.bl.z = (sinf(time * (CGFloat)M_PI *m_nWaves * 2 + (coords.bl.y+coords.bl.x) * .01f) * m_fAmplitude * m_fAmplitudeRate ); coords.br.z = coords.bl.z; coords.tl.z = coords.bl.z; coords.tr.z = coords.bl.z; setTile(ccg(i, j), coords); } } }
void CCShatteredTiles3D::update(ccTime time) { CC_UNUSED_PARAM(time); int i, j; if (m_bOnce == false) { for (i = 0; i < m_sGridSize.x; ++i) { for (j = 0; j < m_sGridSize.y; ++j) { ccQuad3 coords = originalTile(ccg(i ,j)); // X coords.bl.x += ( rand() % (m_nRandrange*2) ) - m_nRandrange; coords.br.x += ( rand() % (m_nRandrange*2) ) - m_nRandrange; coords.tl.x += ( rand() % (m_nRandrange*2) ) - m_nRandrange; coords.tr.x += ( rand() % (m_nRandrange*2) ) - m_nRandrange; // Y coords.bl.y += ( rand() % (m_nRandrange*2) ) - m_nRandrange; coords.br.y += ( rand() % (m_nRandrange*2) ) - m_nRandrange; coords.tl.y += ( rand() % (m_nRandrange*2) ) - m_nRandrange; coords.tr.y += ( rand() % (m_nRandrange*2) ) - m_nRandrange; if (m_bShatterZ) { coords.bl.z += ( rand() % (m_nRandrange*2) ) - m_nRandrange; coords.br.z += ( rand() % (m_nRandrange*2) ) - m_nRandrange; coords.tl.z += ( rand() % (m_nRandrange*2) ) - m_nRandrange; coords.tr.z += ( rand() % (m_nRandrange*2) ) - m_nRandrange; } setTile(ccg(i, j), coords); } } m_bOnce = true; } }
void CCSplitCols::update(float time) { unsigned int i; for (i = 0; i < m_sGridSize.width; ++i) { ccQuad3 coords = originalTile(ccp(i, 0)); float direction = 1; if ( (i % 2 ) == 0 ) { direction = -1; } coords.bl.y += direction * m_winSize.height * time; coords.br.y += direction * m_winSize.height * time; coords.tl.y += direction * m_winSize.height * time; coords.tr.y += direction * m_winSize.height * time; setTile(ccp(i, 0), coords); } }
void CCSplitRows::update(cocos2d::ccTime time) { int j; for (j = 0; j < m_sGridSize.y; ++j) { ccQuad3 coords = originalTile(ccg(0, j)); float direction = 1; if ( (j % 2 ) == 0 ) { direction = -1; } coords.bl.x += direction * m_winSize.width * time; coords.br.x += direction * m_winSize.width * time; coords.tl.x += direction * m_winSize.width * time; coords.tr.x += direction * m_winSize.width * time; setTile(ccg(0, j), coords); } }
void CCSplitCols::update(cocos2d::ccTime time) { int i; for (i = 0; i < m_sGridSize.x; ++i) { ccQuad3 coords = originalTile(ccg(i, 0)); float direction = 1; if ( (i % 2 ) == 0 ) { direction = -1; } coords.bl.y += direction * m_winSize.height * time; coords.br.y += direction * m_winSize.height * time; coords.tl.y += direction * m_winSize.height * time; coords.tr.y += direction * m_winSize.height * time; setTile(ccg(i, 0), coords); } }
void CCSplitRows::update(float time) { unsigned int j; for (j = 0; j < m_sGridSize.height; ++j) { ccQuad3 coords = originalTile(ccp(0, j)); float direction = 1; if ( (j % 2 ) == 0 ) { direction = -1; } coords.bl.x += direction * m_winSize.width * time; coords.br.x += direction * m_winSize.width * time; coords.tl.x += direction * m_winSize.width * time; coords.tr.x += direction * m_winSize.width * time; setTile(ccp(0, j), coords); } }
void CCTurnOffTiles::turnOnTile(const ccGridSize& pos) { setTile(pos, originalTile(pos)); }
void CCTurnOffTiles::turnOnTile(cocos2d::ccGridSize pos) { setTile(pos, originalTile(pos)); }
void CCFadeOutTRTiles::turnOnTile(const ccGridSize& pos) { setTile(pos, originalTile(pos)); }
void CCTurnOffTiles::turnOnTile(const CCPoint& pos) { setTile(pos, originalTile(pos)); }
void CCFadeOutTRTiles::turnOnTile(cocos2d::ccGridSize pos) { setTile(pos, originalTile(pos)); }
void CCFadeOutTRTiles::turnOnTile(const CCPoint& pos) { setTile(pos, originalTile(pos)); }