示例#1
0
void SplitBomb::fadeout(){
    stopAnim();
    getPhysicsBody()->setEnable(false);
    const std::function<void()> callback = [&](void){
        m_armature->setOpacity(255);
        getPhysicsBody()->setEnable(true);
        this->hide();
    };
    m_armature->runAction( CCSequence::create(CCFadeOut::create(0.3f),CallFunc::create(callback), NULL) );
}
示例#2
0
void luAnimDlg::OnPlayClick( wxCommandEvent& WXUNUSED(event) )
{
	wxString name = m_animList->GetStringSelection();
	if (name.IsEmpty()) return;

	m_playAnim = !m_playAnim;

	if (m_playAnim)
		playAnim(name);
	else
		stopAnim();
}
示例#3
0
文件: Bullet.cpp 项目: joyfish/Shoot
void Bullet::fadeout(){
    if (!getPhysicsBody()->isEnabled()) {
        return;
    }
    stopAnim();
    getPhysicsBody()->setVelocity(Point::ZERO);
    getPhysicsBody()->setEnable(false);
    const std::function<void()> callback = [&](void){
        m_armature->setOpacity(255);
        getPhysicsBody()->setEnable(true);
        this->hide();
    };
    m_armature->runAction( CCSequence::create(CCFadeOut::create(0.3f),CallFunc::create(callback), NULL) );
}
示例#4
0
文件: Bullet.cpp 项目: joyfish/Shoot
void Bullet::hide(){
    stopAnim();
    removeFromParentAndCleanup(false);
}
示例#5
0
void CGO_Player::setAniDirState (Uint8 state, Uint8 direction)
{
	bool directionChanged = false;

	// direction is different
	if (this->direction != direction)
	{
		// set the new direction
		if (direction < ANONE)
		{
			this->direction = direction;
			directionChanged = true;
		}

		// if direction is NONE, set the previous direction
		if (direction == ANONE)
		{
			direction = this->direction;
		}
	}

	if (this->ani != NULL && this->stateAni == state && !directionChanged)
	{
		// nothing
	}
	else
	{
		setAnimLoop(true);

		switch (state)
		{
		case SSTAND:
			stopAnim();
			this->stateAni = SSTAND;
			ani = &(a_stand[direction]);
			///////////////		render.PushRedrawEvent();
			break;
		case SWALK:
			this->stateAni = SWALK;
			stopAnim();
			ani = &(a_walk[direction]);
			startAnim();
			break;
		case SCORNERHEAD:
			this->stateAni = SCORNERHEAD;
			srand(SDL_GetTicks() + state + direction + getX() + getY() );
			stopAnim();
			ani = &(a_cornerhead[rand() % CCORNERHEAD]);
			startAnim();
			break;
		case SDIE:
			this->stateAni = SDIE;
			setAnimLoop(false); // die and freeze
			srand(SDL_GetTicks() + state + direction + getX() + getY() );
			stopAnim();
			ani = &(a_die[rand() % CDIES]);
			startAnim();
			break;
		case SPUNCH:
			this->stateAni = SPUNCH;
			stopAnim();
			ani = &(a_punch[direction]);
			startAnim();
			break;
		case SKICK:
			this->stateAni = SKICK;
			stopAnim();
			ani = &(a_kick[direction]);
			startAnim();
			break;
		case SPICKUP:
			this->stateAni = SPICKUP;
			stopAnim();
			ani = &(a_pickup[direction]);
			startAnim();
			break;
		case SSPIN:
			this->stateAni = SSPIN;
			stopAnim();
			ani = &(a_spin);
			startAnim();
			break;
		}

		//	 cout << "direction: " << (int)direction << ", stateAni: " << (int)state << endl;

	}
}
示例#6
0
void SplitBomb::hide(){
    stopAnim();
    removeFromParentAndCleanup(false);
}