Ejemplo n.º 1
0
Background::Background()
	: Sprite(Texture::ID::Background)
	, mCenter(GetTextureInfos()->infos.Width / 2, GetTextureInfos()->infos.Height / 2, 0)
{
	SetPivot(mCenter);
	SetRotationRad(0, 0, D3DX_PI);
}
Ejemplo n.º 2
0
Text::Text(Texture::ID id, D3DXVECTOR2 pos, bool visibility)
	: Sprite(id)
	, mCenter(GetTextureInfos()->infos.Width / 2, GetTextureInfos()->infos.Height / 2, 0.f )
{
	SetPivot(mCenter);
	SetRotationRad(D3DX_PI, 0.f, D3DX_PI);
	SetVisible(visibility);
	SetPosition(pos.x + mCenter.x, pos.y - mCenter.y);
}
Ejemplo n.º 3
0
void Canon::Rotate(float dt)
{
	const float ROT_MIN = 0;
	const float ROT_MAX = 180;

	if (gDInput->keyDown(DIKEYBOARD_A) && canonRot >= ROT_MIN)
	{
		canonRot -= ROTATION_SPEED * dt * 180 / D3DX_PI;
		shotRot -= ROTATION_SPEED * dt * 180 / D3DX_PI;
		SetRotationRad(0, 0, canonRot);
	}

	if (gDInput->keyDown(DIKEYBOARD_D) && canonRot * 180 / D3DX_PI <= ROT_MAX)
	{
		canonRot += ROTATION_SPEED * dt * 180 / D3DX_PI;
		shotRot += ROTATION_SPEED * dt * 180 / D3DX_PI;
		SetRotationRad(0, 0, canonRot);
	}
}
Ejemplo n.º 4
0
Canon::Canon()
	: Sprite(Texture::ID::Canon)
	, mCenter(GetTextureInfos()->infos.Width / 2, GetTextureInfos()->infos.Height / 2, 0)
	, shotRot(0)
	, canonRot(D3DX_PI / 2)
	, ROTATION_SPEED(0.1)
	, isShot(false)
	, waitTime(0.f)
	, isGainLife(false)
	, waitGainLife(0.f)
	, shotDirection(0.f, 0.f, 0.f)
	, nbBalls(3)
{
	SetPivot(mCenter);
	SetRotationRad(0.f, 0.f, canonRot);
	SetPosition(0, gApp->GetParam().BackBufferHeight / 2);

	hudLives = new HUDLives();
	hudLives->UpdateLives(nbBalls);
}