Example #1
0
TintBy* TintBy::create(float duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue)
{
    TintBy *pTintBy = new TintBy();
    pTintBy->initWithDuration(duration, deltaRed, deltaGreen, deltaBlue);
    pTintBy->autorelease();

    return pTintBy;
}
bool GameColorButton::onTouchBegan(Touch* touch, Event* event)
{
    if ( !containsTouchLocation(touch) )return false;
    
    if (aGameScene->isFirstIn)
    {
        aGameScene->AllGameColorButtonMoveBy(Point(0,-VisibleRect::getVisibleRect().size.height/4),rectScrollSpeed_macro,0.0f);
        
        aGameScene->isFirstIn = false;
        
        return false;
    }
    if(2 == isBlack)
    {
        return false;
    }
    if (aGameScene->isTouchLock)
    {
        return false;
    }
    if(0 == isBlack)
    {
        aGameScene->isTouchLock=true;
        CocosDenshion::SimpleAudioEngine::getInstance()->playEffect(clickWhiteEffect_macro );
        CallFuncN * callFuncN = CallFuncN::create( CC_CALLBACK_1(GameColorButton::replayGameOverScene, this, true));
        
        TintBy * tint = TintBy::create(0.3f, 240, 650, 85);
        auto reverse = tint->reverse();
        runAction(Sequence::create(tint,reverse,callFuncN,NULL));
    }
    else
    {
        if(getTag() != aGameScene->blackRectTagVec[0])
        {
            aGameScene->gameOver2();
        }
        else
        {
            CocosDenshion::SimpleAudioEngine::getInstance()->playEffect(clickBlackEffect_macro );
            clickBlack();
        }
    }
    return true;
}
Example #3
0
void Player::isHit()
{
	if (invurnerable)
		return;

	this->HP -= 10;
	this->invurnerable = true;
	this->invurnerableTime = 90;

	// TODO: discuss if this is necessary
	this->getPhysicsBody()->applyImpulse(Vect(-70, 0));

	//FadeIn* fadeIn = FadeIn::create(0.5f);
	//FadeOut* fadeOut = FadeOut::create(0.5f);
	TintBy* tintToWhite = TintBy::create(1, 0, 255, 255);
	TintBy* tintBack = tintToWhite->reverse();
	//Sequence* sequence = Sequence::create(fadeOut, fadeIn, fadeOut,fadeIn,fadeOut, fadeIn, nullptr);
	Sequence* sequence = Sequence::create(tintToWhite, tintToWhite, tintToWhite, nullptr);
	
	this->runAction(sequence);
}