void BubBubbleAnimator::OnBubbleExpiredTime(void* args){
	DASSERT( args);
	BubBubbleAnimator * _this = (BubBubbleAnimator*)args;
	REMOVE_FROM_ACTION_ANIMATOR( _this );

	FrameRangeAnimation *fra = (FrameRangeAnimation*) AnimationsParser::GetAnimation(_this->GetSprite()->GoesLeft()?"BubbleLeft":"BubbleRight");
	Sprite *sprite=new Sprite(
								_this->GetSprite()->GetX(),
								_this->GetSprite()->GetY(),
								false,
								AnimationFilmHolder::GetFilm( "BubPingBubble" ), 
								Terrain::GetActionLayer(), 
								true
							);
	TickAnimation *ta = (TickAnimation*) AnimationsParser::GetAnimation("BubPigBubbleExpired");
	TimerTickAnimator* ttar = new TimerTickAnimator(ta);
	ttar->SetOnFinish(BubblesAnimatorActions::OnTickTimerFinishCallback, 0);

	BubPingBubbleAnimator* bpbamr = new BubPingBubbleAnimator(ttar);
	bpbamr->RegistCollitions(sprite);

	ta->SetTickAction( BubPingBubbleAnimator::OnBubbleExpiredTime, bpbamr );

	ttar->Start(GetGameTime());
	AnimatorHolder::Register( ttar );				
	AnimatorHolder::MarkAsRunning( ttar );
	START_ANIMATOR(bpbamr, sprite, fra, GetGameTime() );
	DESTROY_ANIMATOR( _this );
}
void MightaAngryThrowFireBallAnimator::OnFinishCallback(Animator* anim, void* args){
	DASSERT( anim && args);
	MightaAngryThrowFireBallAnimator * _this = (MightaAngryThrowFireBallAnimator*)args;
	DASSERT( anim==_this );

	REMOVE_FROM_ACTION_ANIMATOR( _this );

	FrameRangeAnimation *fra= (FrameRangeAnimation*)AnimationsParser::GetAnimation(_this->GetSprite()->GoesLeft()?"MightaAngryWalkLeft":"MightaAngryWalkRight");
	Sprite *n_sprite=new Sprite(_this->GetSprite()->GetX(),_this->GetSprite()->GetY(),
		_this->GetSprite()->IsGravityAddicted(),AnimationFilmHolder::GetFilm("MightaAngry"), 
						Terrain::GetActionLayer(), _this->GetSprite()->GoesLeft());

	FrameRangeAnimation *ball=(FrameRangeAnimation*)AnimationsParser::GetAnimation(_this->GetSprite()->GoesLeft()?"MightaMovingFireBallLeft":"MightaMovingFireBallRight");
	Sprite *newSprite=new Sprite(_this->GetSprite()->GoesLeft()?(_this->GetSprite()->GetX()-35):(_this->GetSprite()->GetX()+35),
		_this->GetSprite()->GetY(),false,AnimationFilmHolder::GetFilm("MightaBubble"), 
					Terrain::GetActionLayer(), _this->GetSprite()->GoesLeft());
	newSprite->SetOnDrugs(true);
	MightaMovingFireBallAnimator *mmfa=new MightaMovingFireBallAnimator();
	MightaAngryWalkingAnimator *frtor=new MightaAngryWalkingAnimator();
	
	n_sprite->AddStartFallingListener(frtor);

	frtor->RegistCollitions(n_sprite);
	mmfa->RegistCollitions(newSprite);

	START_ANIMATOR( frtor, n_sprite, fra, GetGameTime() );
	START_ANIMATOR( mmfa, newSprite, ball, GetGameTime() );
	DESTROY_ANIMATOR( _this );
}
void BubBubbleBlastOffAnimator::OnFinishCallback(Animator* anim, void* args){
	DASSERT( anim && args);
	BubBubbleBlastOffAnimator * _this = (BubBubbleBlastOffAnimator*)args;
	DASSERT( anim==_this );
	DASSERT( _this->GetAnimation() && _this->GetSprite() );
	
	REMOVE_FROM_ACTION_ANIMATOR( _this );
	
	FrameRangeAnimation *fra = (FrameRangeAnimation*) AnimationsParser::GetAnimation(_this->GetSprite()->GoesLeft()?"BubbleLeft":"BubbleRight");
	Sprite *sprite=new Sprite(
								_this->GetSprite()->GetX(),
								_this->GetSprite()->GetY(),
								false,
								AnimationFilmHolder::GetFilm( "BubBubble" ), 
								Terrain::GetActionLayer(), 
								_this->GetSprite()->GoesLeft()
							);

	TickAnimation *ta = (TickAnimation*) AnimationsParser::GetAnimation("BubBubbleExpired");
	TimerTickAnimator* ttar = new TimerTickAnimator(ta);
	ttar->SetOnFinish(BubblesAnimatorActions::OnTickTimerFinishCallback, 0);

	BubBubbleAnimator *bbar=new BubBubbleAnimator(ttar);
	bbar->RegistCollitions(sprite);
	ta->SetTickAction( BubBubbleAnimator::OnBubbleExpiredTime, bbar );

	START_ANIMATOR(bbar, sprite, fra, GetGameTime() );
	START_TIME_ANIMATOR(ttar, GetGameTime());
	DESTROY_ANIMATOR( _this );
	
}
static void AfterDieProcedure(BubDieAnimator* _this){
	bool currLifes = -1;
	BubProfile* currProfile;
	_this->GetSprite()->IsBub()? currProfile = BubbleLogic::GetBubProfile():
								 currProfile = BubbleLogic::GetBobProfile();

	if (currProfile->GetLifes() > 1){

		MovingAnimation *fra= (MovingAnimation*)AnimationsParser::GetAnimation("BubStand");
		Sprite *n_sprite=new Sprite(currProfile->GetStartX(), 
									currProfile->GetStartY(),
									currProfile->GetStartGravity(),
									AnimationFilmHolder::GetFilm("BubWalk"), 
									Terrain::GetActionLayer(),
									currProfile->GetStartDirection());


			n_sprite->SetIsBub(_this->GetSprite()->IsBub());
			BubStandAnimator *frtor=new BubStandAnimator();
			START_ANIMATOR( frtor, n_sprite, fra, GetGameTime() );

		////// refresh bub profile
		currProfile->SetScore(currProfile->GetScore() / 2);
		currProfile->DecrLifes();	
	}
	else{
		currProfile->SetScore(-1);
		currProfile->DecrLifes();
	}
	currProfile->SetYellowSwt(false);
	currProfile->SetBlueSwt(false);
	currProfile->SetPurpleSwt(false);
	currProfile->SetRedShoes(false);
}
Ejemplo n.º 5
0
Animation * Animation::AddAnimation(Object * source) const
{
	if (GetState() == true)
	{
		ActiveAnimations.Append(new Animation);

		Animation * newAnim = ActiveAnimations.GetLast();
		newAnim->Copy(*this);
		newAnim->source = source;

		const char * animScript = script.GetScript();
		newAnim->script.LoadScript(animScript, newAnim);

		const char * onAddScript = onAdd.GetScript();
		newAnim->onAdd.LoadScript(onAddScript, newAnim);

		newAnim->sprite = sprite;

		newAnim->bounds = bounds;
		newAnim->scalingCenter = scalingCenter;
		newAnim->rotationCenter = rotationCenter;
		newAnim->offset = offset;

		newAnim->color = color;

		newAnim->onAdd.ActivateScript(true);
		newAnim->SetUInt32Value(ANIM_VAR_START_TIME, GetGameTime());

		return newAnim;
	}

	return NULL;
}
Ejemplo n.º 6
0
void CGameServer::ClientConnect(int iClient)
{
	GameNetwork()->CallFunction(iClient, "ClientInfo", iClient, GetGameTime());

	if (GetGame())
		GetGame()->OnClientConnect(iClient);
}
void BaronVonBlubaRushAnimator::OnFinishCallback(Animator* animr, void* args){
	DASSERT( animr &&  animr == args);
	BaronVonBlubaRushAnimator* _this = (BaronVonBlubaRushAnimator*)args;
	DASSERT( _this->GetAnimation() && _this->GetSprite());
	REMOVE_FROM_ACTION_ANIMATOR( _this );

	Sprite* nSprite = _this->GetSprite();
	nSprite->ClearListeners();
	MovingAnimation* man = (MovingAnimation*) AnimationsParser::GetAnimation("BarronVonBlubaStand");
	BaronVonBlubaStandAnimator::direction dir;
	const PathEntry animPath = _this->GetAnimation()->GetPath().front();
	if( animPath.x>0 )
		dir = BaronVonBlubaStandAnimator::direction_rigth_t;
	else
	if(animPath.x<0)
		dir = BaronVonBlubaStandAnimator::direction_left_t;
	else
	if(animPath.y>0)
		dir = BaronVonBlubaStandAnimator::direction_down_t;
	else
	if(animPath.y<0)
		dir = BaronVonBlubaStandAnimator::direction_up_t;
	else
		DASSERT(false);

	BaronVonBlubaStandAnimator* vvbsar = new BaronVonBlubaStandAnimator(dir);
	START_ANIMATOR( vvbsar, nSprite, man, GetGameTime() );

	DESTROY_ANIMATOR_WITHOUT_SPRITE( _this );
}
static void startBubBubbleAnimator(Sprite* sprite){

	std::vector<Animator*> bubbles = AnimatorHolder::GetAnimators(bubBubbleAnimator_t);
	if(bubbles.size()>20){
		BubBubbleAnimator * _this = (BubBubbleAnimator *) bubbles.front();	
		REMOVE_FROM_ACTION_ANIMATOR( _this );	
		BubblesAnimatorActions::OnTickTimerFinishCallback(_this->getBubBubbleTimer(), 0);													
		DESTROY_ANIMATOR( _this );	
	}

	FrameRangeAnimation *frab = 
		(FrameRangeAnimation*) AnimationsParser::GetAnimation(
									BubbleLogic::GetBubProfile()->GetBubbleBlastAnimation(sprite->GoesLeft() )
															 );
	Sprite *n_spriteb=new Sprite(
								sprite->GetX(),
								sprite->GetY(),
								sprite->IsGravityAddicted(),
								AnimationFilmHolder::GetFilm( "BubBubbleBlastOff" ), 
								Terrain::GetActionLayer(), 
								sprite->GoesLeft()
								);
	n_spriteb->SetIsBub(sprite->IsBub());
	BubBubbleBlastOffAnimator *bbar=new BubBubbleBlastOffAnimator();
	bbar->RegistCollitions(n_spriteb);
	START_ANIMATOR( bbar, n_spriteb, frab, GetGameTime() );
}
Ejemplo n.º 9
0
Float BuildTower(Script * script)
{
	if (script->VerifyArguments(2) == true)
	{
		Word * targetWord = script->GetNextWord();
		Word * posWord = script->GetNextWord();

		Point2D position(0, 0);
		Point2D * pos = (Point2D *)(uint32)posWord->value;
		if (pos != NULL)
		{
			position.SetValues(pos->GetX(), pos->GetY());
		}
		else
		{
			return false;
		}

		if ((IntervalCheck(position.GetX(), 1, GRID_SIZE - 2) == true) && (IntervalCheck(position.GetY(), 1, GRID_SIZE - 2) == true))
		{
			if (targetWord->type == POINTER)
			{
				Object * target = script->GetTarget(targetWord);
				if ((target != NULL) && (target->CheckType(OBJ_TYPE_TOWER) == true))
				{
					Grid * grid = WorldGame.GetGrid();
					Tower * tower = (Tower *)target;

					//To bypass grid auto-filling
					tower->SetState(false);

					Point2D towerCoords = tower->GetPosition();
					towerCoords.SetValues((towerCoords.GetX() - 80)/32, (towerCoords.GetY() - 80)/32);
					grid->SetPath(towerCoords, 0);	

					if (BuildTower(tower->GetTowerType(), position, true) == true)
					{
						Tower * newTower = grid->GetData(Point2D(position.GetX(), position.GetY()));
						tower->SetState(true);
						grid->FindPath(Origin);
						newTower->Copy(*tower);
						newTower->SetUInt32Value(TOWER_VAR_BUILD_TIME, GetGameTime());
						return true;
					}
					else
					{
						tower->SetState(true);
						grid->FindPath(Origin);
					}
				}
			}
			else if ((targetWord->type == NUMERIC) && (IntervalCheck(targetWord->value, 1, GetTowerDataSize()) == true))
			{
				return (BuildTower(targetWord->value, position, true));
			}
		}
	}
	return false;
}
void BaronVonBlubaAnimatorActions::StartHurryUpAnimator(void* args){
	Sprite* newSprite = 
		new Sprite(200, 50, false, AnimationFilmHolder::GetFilm("HurryUp"), Terrain::GetActionLayer(),true);
	newSprite->SetOnDrugs(true);
	MovingPathAnimation* mpa = (MovingPathAnimation*)AnimationsParser::GetAnimation("HurryUp");
	HurryUpAnimator* hua = new HurryUpAnimator();
	START_ANIMATOR( hua, newSprite, mpa, GetGameTime() );
	SoundAPI::PlaySoundContinue(SoundAPI::soundKind_ingameMusicHurryUp_t, true);
}
static void StartMightaDieAnimator( int x, int y ){
	Sprite* newSprite = 
		new Sprite(x, y, true, AnimationFilmHolder::GetFilm("MightaDie"), Terrain::GetActionLayer(),false);

	MovingPathAnimation* mpa = (MovingPathAnimation*)AnimationsParser::GetAnimation("MightaDie");
	MightaDieAnimator *bda = new MightaDieAnimator();
	newSprite->AddStartFallingListener(bda);
	START_ANIMATOR( bda, newSprite, mpa, GetGameTime() );
}
Ejemplo n.º 12
0
void AnimationMaintenance()
{
	while (RemovedAnimations.GetSize() > 0)
	{
		if (RemovedAnimations[0] != NULL)
		{
			delete RemovedAnimations[0];
		}
		RemovedAnimations.Remove(0);
	}

	ActiveAnimations.ToStart();
	for (int32 i = 0; i < ActiveAnimations.GetSize(); i++)
	{
		Animation * animation = ActiveAnimations.GetCurrent();
		Object * source = animation->GetSource();
		ActiveAnimations.ToNext();

		if ((source != NULL) && (source->GetState() == false))
		{
			animation->SetSource(NULL);
		}

		if (animation != NULL)
		{
			if (animation->GetState() == false)
			{
				RemovedAnimations.Append(animation);
				ActiveAnimations.Remove(i);
				i--;
			}
			else
			{
				Object * source = animation->GetSource();

				uint32 duration = animation->GetUInt32Value(ANIM_VAR_DURATION);
				uint32 startTime = animation->GetUInt32Value(ANIM_VAR_START_TIME);

				if (((duration == 0) && (source != NULL) && (source->GetState() == true)) || ((GetGameTime() - startTime) < duration))
				{
					animation->ActivateScript();
				}
				else
				{
					animation->Unload();
				}
			}
		}
		else
		{
			ActiveAnimations.Remove(i);
			i--;
		}
	}
		
}
Ejemplo n.º 13
0
// Called once at the start of the game
void InitGameTime()
{
	// We need to know how often the clock is updated
	if( !QueryPerformanceFrequency((LARGE_INTEGER *)&ticksPerSecond) )
		ticksPerSecond = 1000;
	// If timeAtGameStart is 0 then we get the time since
	// the start of the computer when we call GetGameTime()
	timeAtGameStart = 0;
	timeAtGameStart = GetGameTime();
}
Ejemplo n.º 14
0
void BubJumpOpenMouthAnimator::OnFinishCallback(Animator* anim, void* args){
	DASSERT( anim && args && anim==args);
	BubJumpOpenMouthAnimator * _this = (BubJumpOpenMouthAnimator*)args;
	REMOVE_FROM_ACTION_ANIMATOR( _this );


	int index = _this->GetIndex();
	index+=_this->GetAnimation()->GetPath().size();
	if( ((int) _this->GetJumpAnimation()->GetPath().size()) <= index ){
		MovingAnimation *fra = (MovingAnimation*)AnimationsParser::GetAnimation("BubFalling");
		Sprite *n_sprite = new Sprite(
										_this->GetSprite()->GetX(),
										_this->GetSprite()->GetY(),
										_this->GetSprite()->IsGravityAddicted(),
										AnimationFilmHolder::GetFilm("BubWalk"), 
										Terrain::GetActionLayer(), 
										_this->GetSprite()->GoesLeft()
									);
		n_sprite->SetIsBub(_this->GetSprite()->IsBub());
		BubFallingAnimator *frtor=new BubFallingAnimator();
		n_sprite->AddStopFallingListener(frtor);
		frtor->RegistCollitions(n_sprite);
		START_ANIMATOR( frtor, n_sprite, fra, GetGameTime() );
		_this->GetJumpAnimation()->Destroy();
	}else{

		Sprite *n_sprite = new Sprite(
										_this->GetSprite()->GetX(),
										_this->GetSprite()->GetY(),
										_this->GetSprite()->IsGravityAddicted(),
										AnimationFilmHolder::GetFilm("BubWalk"), 
										Terrain::GetActionLayer(), 
										_this->GetSprite()->GoesLeft()
									);
		n_sprite->SetIsBub(_this->GetSprite()->IsBub());
		BubJumpAnimator* mar = new BubJumpAnimator();
		START_ANIMATOR( mar, n_sprite, _this->GetJumpAnimation(), GetGameTime() );
		mar->SetCurrIndex(index);
	}

	DESTROY_ANIMATOR( _this );
}
Ejemplo n.º 15
0
void BubDieByFireFallingAnimator::OnStopFalling(Sprite * sprite){
	DASSERT( sprite == this->GetSprite() );
	REMOVE_FROM_ACTION_ANIMATOR( this );
	
	INIT_NEW_INSTANCE_WITH_SPRITE(	MovingPathAnimation, zenStandAnmn, "BubDieByFire",

					BubDieByFireAnimator, zenStandAnmr, this->GetSprite() );	
	
	START_ANIMATOR( zenStandAnmr, this->GetSprite(), zenStandAnmn, GetGameTime());
	DESTROY_ANIMATOR_WITHOUT_SPRITE( this );
}
void MightaFallingAnimator::OnStopFalling(Sprite * sprite){
	DASSERT( sprite == this->GetSprite() );
	REMOVE_FROM_ACTION_ANIMATOR( this );

	INIT_NEW_INSTANCE_WITH_SPRITE(	FrameRangeAnimation, zenStandAnmn, this->GetSprite()->GoesLeft()?"MightaWalkLeft":"MightaWalkRight",
						MightaWalkingAnimator, zenStandAnmr, this->GetSprite() );	
	zenStandAnmr->RegistCollitions(this->GetSprite());
	this->GetSprite()->AddStartFallingListener( zenStandAnmr );
	START_ANIMATOR( zenStandAnmr, this->GetSprite(), zenStandAnmn, GetGameTime() );
	DESTROY_ANIMATOR_WITHOUT_SPRITE( this );
}
Ejemplo n.º 17
0
void game_sv_GameState::net_Export_GameTime						(NET_Packet& P)
{
//#pragma todo("It should be done via single message, why always pass this data?")
//#if 0
	//Syncronize GameTime 
	P.w_u64(GetGameTime());
	P.w_float(GetGameTimeFactor());
	//Syncronize EnvironmentGameTime 
	P.w_u64(GetEnvironmentGameTime());
	P.w_float(GetEnvironmentGameTimeFactor());
//#endif
};
void ZenChanDieFallingAnimator::OnStopFalling(Sprite * sprite){
	DASSERT( sprite == this->GetSprite() );
	REMOVE_FROM_ACTION_ANIMATOR( this );
	bool dieFrom = this->GetRiverDie();

	INIT_NEW_INSTANCE_WITH_SPRITE(	MovingPathAnimation, zenStandAnmn, "ZenChanDie",
					ZenChanDieAnimator, zenStandAnmr, this->GetSprite() );	
	zenStandAnmr->SetRiverDie(dieFrom);
	
	START_ANIMATOR( zenStandAnmr, this->GetSprite(), zenStandAnmn, GetGameTime() );
	DESTROY_ANIMATOR_WITHOUT_SPRITE( this );
}
void HurryUpAnimator::OnFinishCallback(Animator* anim, void* args){
	DASSERT( anim==args );
	HurryUpAnimator* _this = (HurryUpAnimator*) anim;
	REMOVE_FROM_ACTION_ANIMATOR( _this );

	TickAnimation *ta = (TickAnimation*) AnimationsParser::GetAnimation("BarronVonBlubaStart");
	ta->SetTickAction( BaronVonBlubaAnimatorActions::StartBaronVonBludaAnimator, 0 );
	TimerTickAnimator* ttar = new TimerTickAnimator(ta);
	ttar->SetOnFinish(BubblesAnimatorActions::OnTickTimerFinishCallback, 0);
	START_TIME_ANIMATOR(ttar, GetGameTime());

	DESTROY_ANIMATOR(_this);
}
void ZenChanAngryWalkingAnimator::OnStartFalling(Sprite * sprite){
	DASSERT( sprite == this->GetSprite() );
	REMOVE_FROM_ACTION_ANIMATOR( this );

	INIT_NEW_INSTANCE_WITH_SPRITE(	FrameRangeAnimation, zenFallAnmn, "ZenChanAngryFalling",
						ZenChanAngryFallingAnimator, zenFallAnmr, this->GetSprite() );

	this->GetSprite()->AddStopFallingListener(zenFallAnmr);
	zenFallAnmr->RegistCollitions(this->GetSprite());

	START_ANIMATOR( zenFallAnmr, this->GetSprite(), zenFallAnmn, GetGameTime() );
	DESTROY_ANIMATOR_WITHOUT_SPRITE( this );
}
static void StartZenChanAtBubbleAnimator(int x, int y, bool goesLeft){
	FrameRangeAnimation *fra = (FrameRangeAnimation*) AnimationsParser::GetAnimation(goesLeft?"BubbleLeft":"BubbleRight");
	Sprite *sprite=new Sprite(
								x,
								y,
								false,
								AnimationFilmHolder::GetFilm( "ZenChanInBubble" ), 
								Terrain::GetActionLayer(), 
								true
							);
	TickAnimation *ta = (TickAnimation*) AnimationsParser::GetAnimation("BubBubbleExpired");
	TimerTickAnimator* ttar = new TimerTickAnimator(ta);
	ttar->SetOnFinish(BubblesAnimatorActions::OnTickTimerFinishCallback, 0);

	ZenChanInBubbleAnimator* zcibanmr = new ZenChanInBubbleAnimator(ttar);
	zcibanmr->RegistCollitions(sprite);
	ta->SetTickAction( ZenChanInBubbleAnimator::OnBubbleExpiredTime, zcibanmr );
	START_ANIMATOR(zcibanmr, sprite, fra, GetGameTime() );
	ttar->Start(GetGameTime());
	AnimatorHolder::Register( ttar );				
	AnimatorHolder::MarkAsRunning( ttar );
}
void MightaMovingFireBallAnimator::OnCollisionWithWall(Sprite *ball, Sprite *wall, void * args){
	DASSERT( ball && wall && args );
	MightaMovingFireBallAnimator * _this = (MightaMovingFireBallAnimator*) args;
	REMOVE_FROM_ACTION_ANIMATOR( _this );

	FrameRangeAnimation *fra= (FrameRangeAnimation*)AnimationsParser::GetAnimation("MightaDestroyedFireBall");
	Sprite *n_sprite = new Sprite(_this->GetSprite()->GetX(),_this->GetSprite()->GetY(),_this->GetSprite()->IsGravityAddicted(),
									AnimationFilmHolder::GetFilm("MightaDestroyBubble"), Terrain::GetActionLayer(), 
									_this->GetSprite()->GoesLeft());
	n_sprite->SetOnDrugs(true);
	MightaDestroyedFireBallAnimator *frtor=new MightaDestroyedFireBallAnimator();
	START_ANIMATOR(frtor, n_sprite, fra, GetGameTime() );
	DESTROY_ANIMATOR( _this );
}
Ejemplo n.º 23
0
void BubWalkingAnimator::OnFinishCallback(Animator* anim, void* args){
	DASSERT( anim && args);
	BubWalkingAnimator * _this = (BubWalkingAnimator*)args;
	DASSERT( _this->GetAnimation() && _this->GetSprite() && anim==_this );
	REMOVE_FROM_ACTION_ANIMATOR( _this );

	Sprite * newSprite = _this->GetSprite();
	MovingAnimation *ma = (MovingAnimation*) AnimationsParser::GetAnimation("BubStand");
	newSprite->SetFrame(0);
	BubStandAnimator* mar = new BubStandAnimator();
	mar->RegistCollitions(newSprite);
	START_ANIMATOR( mar, newSprite, ma, GetGameTime() );
	DESTROY_ANIMATOR_WITHOUT_SPRITE( _this );
}
void ZenChanDieAnimator::OnStartFalling(Sprite * sprite){
	
	DASSERT( sprite == this->GetSprite() );
	REMOVE_FROM_ACTION_ANIMATOR( this );
	bool dieFrom = this->GetRiverDie();

	INIT_NEW_INSTANCE_WITH_SPRITE(	FrameRangeAnimation, zenFallAnmn, "ZenChanFalling",
						ZenChanDieFallingAnimator, zenFallAnmr, this->GetSprite() );
	zenFallAnmr->SetRiverDie(dieFrom);

	this->GetSprite()->AddStopFallingListener(zenFallAnmr);
	START_ANIMATOR( zenFallAnmr, this->GetSprite(), zenFallAnmn, GetGameTime() );
	DESTROY_ANIMATOR_WITHOUT_SPRITE( this );
}
Ejemplo n.º 25
0
void BubDieAnimator::OnStartFalling(Sprite * sprite){
	DASSERT( sprite == this->GetSprite() );
	REMOVE_FROM_ACTION_ANIMATOR( this );

	MovingAnimation *fra= (MovingAnimation*)AnimationsParser::GetAnimation("BubFalling");
	sprite->ClearListeners();
	
	BubDieFallingAnimator *frtor=new BubDieFallingAnimator();
	frtor->RegistCollitions(sprite);
	sprite->AddStopFallingListener(frtor);
	START_ANIMATOR( frtor, sprite, fra, GetGameTime() );

	DESTROY_ANIMATOR_WITHOUT_SPRITE( this );
}
void powerUpsAnimatorStart::startPurpleSweetAnimator(){
	Sprite* sprite = new Sprite(															
									BubbleLogic::GetPowerUpPosXY().first,					
									BubbleLogic::GetPowerUpPosXY().second,					
									true,													
									AnimationFilmHolder::GetFilm( "PurpleSweet" ),					
									Terrain::GetActionLayer(),								
									true													
								);															
	MovingAnimation* anim = (MovingAnimation*) AnimationsParser::GetAnimation( "PurpleSweet" );		
	PurpleSweetAnimator* type = new PurpleSweetAnimator();
	type->RegistCollitions(sprite);															
	START_ANIMATOR( type, sprite, anim, GetGameTime() )	;	
}
static void StartPonEffectAnimator(int x, int y){

	FrameRangeAnimation *mpa = (FrameRangeAnimation*) AnimationsParser::GetAnimation("PonEffect");
	Sprite *sprite=new Sprite(
								x,
								y,
								false,
								AnimationFilmHolder::GetFilm( "PonEffect" ), 
								Terrain::GetActionLayer(), 
								true
							);
	PonEffectAnimator* pear = new PonEffectAnimator();
	pear->RegistCollitions(sprite);
	START_ANIMATOR(pear, sprite, mpa, GetGameTime() );
}
Ejemplo n.º 28
0
static void StartDieByFireAnimator(int x, int y, bool isBub){
	Sprite* newSprite = new Sprite(
									x, 
									y, 
									true, 
									AnimationFilmHolder::GetFilm("BubBurningDie"), 
									Terrain::GetActionLayer(),
									false
								  );
	newSprite->SetIsBub(isBub);
	MovingPathAnimation* mpa=(MovingPathAnimation*)AnimationsParser::GetAnimation("BubDieByFire");
	BubDieByFireAnimator *bda=new BubDieByFireAnimator();
	newSprite->AddStartFallingListener(bda);
	START_ANIMATOR( bda, newSprite, mpa, GetGameTime() );
}
void BaronVonBlubaAnimatorActions::StartBaronVonBludaAnimator(void* args){
	MovingPathAnimation *mpa = (MovingPathAnimation*) AnimationsParser::GetAnimation("BarronVonBlubaRushRight");
	Sprite *sprite = new Sprite(
								10,
								1,
								false,						
								AnimationFilmHolder::GetFilm( "BaronVonBlubba" ), 
								Terrain::GetActionLayer(), 
								false
							);
	sprite->SetOnDrugs(true);
	BaronVonBlubaRushAnimator* bvbrar = new BaronVonBlubaRushAnimator();
	bvbrar->RegistCollitions(sprite);
	START_ANIMATOR(bvbrar, sprite, mpa, GetGameTime() );
	SoundAPI::PlaySoundOnce(SoundAPI::soundKind_booAppears_t, false);
}
void ZenChanWalkingAnimator::OnFinishCallback(Animator* animr, void* args){
	DASSERT( animr && args);
	ZenChanWalkingAnimator* _this = (ZenChanWalkingAnimator*)args;
	DASSERT( animr ==_this );
	DASSERT( _this->GetAnimation() && _this->GetSprite());

	REMOVE_FROM_ACTION_ANIMATOR( _this );

	INIT_NEW_INSTANCE_WITH_SPRITE(	FrameRangeAnimation, zenStandAnmn, "ZenChanStand",
						ZenChanStandAnimator, zenStandAnmr, _this->GetSprite() );

	zenStandAnmr->RegistCollitions(_this->GetSprite() );

	START_ANIMATOR( zenStandAnmr, _this->GetSprite(), zenStandAnmn, GetGameTime() );
	DESTROY_ANIMATOR_WITHOUT_SPRITE(_this );
}