add boostinfo
This commit is contained in:
		| @@ -59,6 +59,11 @@ Vector3f Player::GetInput(bool front, bool back, bool left, bool right, bool jum | ||||
| 		delta.y += jump? .32f: shoot? .1f : 0.f; | ||||
| 		m_airborne = true; | ||||
| 	} | ||||
| 	if (boostspeed) | ||||
| 	{ | ||||
| 		delta.x += STRENGTH_SPEED_BOOST / 100 * delta.x; | ||||
| 		delta.z += STRENGTH_SPEED_BOOST / 100 * delta.z; | ||||
| 	} | ||||
|  | ||||
| 	if (shoot) // Recoil! | ||||
| 		TurnTopBottom(-1); | ||||
| @@ -180,7 +185,7 @@ Player::Sound Player::ApplyPhysics(Vector3f input, World* world, float elapsedTi | ||||
| 	else isStep = false; | ||||
| 	m_POV = m_position.y; | ||||
| 	m_POV += m_airborne ? 0 : (sin(bobbingtime) - 0.5f) * (abs(m_velocity.x) + abs(m_velocity.z)) * .2f; | ||||
|  | ||||
| 	RemoveBooster(elapsedTime); | ||||
| 	return snd; | ||||
| } | ||||
|  | ||||
| @@ -190,6 +195,50 @@ void Player::ApplyTransformation(Transformation& transformation, bool rel) const | ||||
| 	if (rel) transformation.ApplyTranslation(-GetPOV()); | ||||
| } | ||||
|  | ||||
| void Player::GetBooster(Booster boosttype) | ||||
| { | ||||
| 	if (boosttype == SPEED) | ||||
| 	{ | ||||
| 		boostspeed = true; | ||||
| 		timeboostspeed = 0; | ||||
| 	} | ||||
| 	if (boosttype == HEAL) | ||||
| 	{ | ||||
| 		m_hp = 100; | ||||
| 	} | ||||
| 	if (boosttype == DAMAGE) | ||||
| 	{ | ||||
| 		boostdamage = true; | ||||
| 		timeboostdamage = 0; | ||||
| 	} | ||||
| 	if (boosttype == INVINCIBLE) | ||||
| 	{ | ||||
| 		boostinvincible = true; | ||||
| 		boostinvincible = 0; | ||||
| 	} | ||||
| } | ||||
| void Player::RemoveBooster(float elapsedtime) | ||||
| { | ||||
| 	if (boostspeed) | ||||
| 	{ | ||||
| 		timeboostspeed += elapsedtime; | ||||
| 		if (timeboostspeed >= TIME_SPEED_BOOST) | ||||
| 			boostspeed = false; | ||||
| 	} | ||||
| 	if (boostdamage) | ||||
| 	{ | ||||
| 		timeboostdamage += elapsedtime; | ||||
| 		if (timeboostdamage >= TIME_DAMAGE_BOOST) | ||||
| 			boostdamage = false; | ||||
| 	} | ||||
| 	if (boostinvincible) | ||||
| 	{ | ||||
| 		timeboostinvincible += elapsedtime; | ||||
| 		if (timeboostinvincible >= TIME_INVINCIBLE_BOOST) | ||||
| 			boostinvincible = false; | ||||
| 	} | ||||
| } | ||||
|  | ||||
| Vector3f Player::GetPosition() const { return Vector3f(m_position.x + CHUNK_SIZE_X * WORLD_SIZE_X / 2, m_position.y, m_position.z + CHUNK_SIZE_Z * WORLD_SIZE_Y / 2); } | ||||
|  | ||||
| Vector3f Player::GetVelocity() const { return m_velocity; } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user