Example #1
0
Yarn::Yarn() :
	mMuzzleSpeed( 400.f ),
	mVelocity( Vector3::Zero ),
	mPlayerId( 0 )
{
	SetScale( GetScale() * .02f );
	SetCollisionRadius( 15.f );
}
Example #2
0
Yarn::Yarn() :
	mVelocity( Vector3::Zero )
{
	SetScale( GetScale() * 0.25f );
	SetCollisionRadius( 0.125f );
	mSpriteComponent = std::make_shared<SpriteComponent>( this );
	mSpriteComponent->SetTexture( TextureManager::sInstance->GetTexture( "yarn" ) );
}
Example #3
0
RoboCat::RoboCat() :
	GameObject(),
	mHealth( 5 ),
	mState( RC_IDLE ),
	mTargetNetId( 0 ),
	mTimeSinceLastAttack( kYarnCooldown )
{
	SetScale( 0.75f );
	SetCollisionRadius( 0.6f );
	mSpriteComponent = std::make_shared<SpriteComponent>( this );
	mSpriteComponent->SetTexture( TextureManager::sInstance->GetTexture( "cat" ) );
}
Example #4
0
TommyCoin::TommyCoin()
{
	SetScale( GetScale() * 0.5f );
	SetCollisionRadius( 0.25f );
}
Example #5
0
//Improved Initialization with struct implementation
void AnimationObj::Init(AnimationObjStruct *AniStruct){	
	//----------------------------------------
	theReader->AnimationObjFrameInfo(Index, width, height, maxFrame, animationColumns, 
		maxAnimationOrientation, collidable, boundX, boundY, usingTexture, textureID, entranceEffectID, stationary, animationTypeID);
	
	//initialize entrance effect parameters
	if(entranceEffectID != NoEffect)
		useEntranceEffextSprite = true;

	switch(entranceEffectID){
	case Diagonal:
			useEntranceEffextSprite = theReader->GetUseDiagonalSprite(Index, maxEntranceEffextSpriteFrame, animationTypeID);
			if(!useEntranceEffextSprite)
				entranceEffectID = NoEffect;
		break;
	default:
		break;
	}
	
	InitConst();
	//timeStep = TimeStep; //time increwment, used in update()

	usingOrientation = true;
	stationary = false;
	//----------------------------------

	//position coordinate
	x =  AniStruct->X;
	y =  AniStruct->Y;

	x1 =  AniStruct->X1;
	y1 =  AniStruct->Y1;
	x2 =  AniStruct->X2;
	y2 =  AniStruct->Y2;

	//error checking at initialization 
	if(x == 0 && y==0){
		x = (x1 + x2)/2.0;
		y = (y1 + y2)/2.0;
	}
	
	//velocity
	xVel = AniStruct->XVel;
	yVel = AniStruct->YVel;
	SetRotate(AniStruct->Rotation);
	
	boundX = AniStruct->BoundX;
	boundY =  AniStruct->BoundY;

	startTimeInMS =  AniStruct->StartingTimeInMS;
	animationOrientation =  AniStruct->AnimationOrientation;
	frameDelay = AniStruct->FrameDelay;

	////Normalize speed
	//xVel = xVel * TimeStepInSecond;
	//yVel = yVel * TimeStepInSecond;

	if(AniStruct->Radius > 0){
		SetCollisionRadius(AniStruct->Radius);
	}

	//call to set the scale and rotation
	ComputeCoordinate();
}