コード例 #1
0
ファイル: CCActionTiledGrid.cpp プロジェクト: IppClub/Dorothy
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);
        }
    }
}
コード例 #2
0
	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);
			}
		}
	}
コード例 #3
0
ファイル: CCActionTiledGrid.cpp プロジェクト: IppClub/Dorothy
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);
        }
    }
}
コード例 #4
0
ファイル: CCActionTiledGrid.cpp プロジェクト: IppClub/Dorothy
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);
}
コード例 #5
0
	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);
	}
コード例 #6
0
ファイル: CCActionTiledGrid.cpp プロジェクト: IppClub/Dorothy
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);
}
コード例 #7
0
ファイル: CCActionTiledGrid.cpp プロジェクト: IppClub/Dorothy
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);
        }
    }
}
コード例 #8
0
	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);
			}
		}
	}
コード例 #9
0
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;
    }
}
コード例 #10
0
ファイル: CCActionTiledGrid.cpp プロジェクト: IppClub/Dorothy
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);
    }
}
コード例 #11
0
	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);
		}
	}
コード例 #12
0
	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);
		}
	}
コード例 #13
0
ファイル: CCActionTiledGrid.cpp プロジェクト: IppClub/Dorothy
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);
    }
}
コード例 #14
0
void CCTurnOffTiles::turnOnTile(const ccGridSize& pos)
{
    setTile(pos, originalTile(pos));
}
コード例 #15
0
	void CCTurnOffTiles::turnOnTile(cocos2d::ccGridSize pos)
	{
		setTile(pos, originalTile(pos));
	}
コード例 #16
0
void CCFadeOutTRTiles::turnOnTile(const ccGridSize& pos)
{
    setTile(pos, originalTile(pos));
}
コード例 #17
0
ファイル: CCActionTiledGrid.cpp プロジェクト: IppClub/Dorothy
void CCTurnOffTiles::turnOnTile(const CCPoint& pos)
{
    setTile(pos, originalTile(pos));
}
コード例 #18
0
	void CCFadeOutTRTiles::turnOnTile(cocos2d::ccGridSize pos)
	{
		setTile(pos, originalTile(pos));
	}
コード例 #19
0
ファイル: CCActionTiledGrid.cpp プロジェクト: IppClub/Dorothy
void CCFadeOutTRTiles::turnOnTile(const CCPoint& pos)
{
    setTile(pos, originalTile(pos));
}