void BallisticDemo::key(unsigned char key)
{
    switch(key)
    {
		case '1': currentShotType = PISTOL; break;
		case '2': currentShotType = ARTILLERY; break;
		case '3': currentShotType = FIREBALL; break;
		case '4': currentShotType = LASER; break;
		case 'w': ChangePower(1); break;
		case 'W': ChangePower(1); break;
		case 's': ChangePower(-1); break;
		case 'S': ChangePower(-1); break;
		case 'a': ChangeAngle(1); break;
		case 'A': ChangeAngle(1); break;
		case 'd': ChangeAngle(-1); break;
		case 'D': ChangeAngle(-1); break;
    }
}
Пример #2
0
void Enemy::Move()
{
	ChangeAngle();
	DownSpeed();

	if (isDownSpeed == true)
		moveSpeed = Vec2f(moveSpeed.x() / 2, moveSpeed.y() / 2);

	position += moveSpeed;
}
Пример #3
0
void Bot::ApplyPendingTurnToLookAtPoint()
{
    if (!pendingLookAtPointState.IsActive())
        return;

    Vec3 toPointDir(pendingLookAtPointState.lookAtPoint);
    toPointDir -= self->s.origin;
    toPointDir.NormalizeFast();

    ChangeAngle(toPointDir, pendingLookAtPointState.EffectiveTurnSpeedMultiplier(1.0f));
}
Пример #4
0
// -----------------------------------
// MAIN TICK METHOD
void Turret::Tick(double deltaTime, DOUBLE2 heroPos)
{
	m_DeltaTime = deltaTime;
	m_HeroPos = heroPos;
	++m_TickCount;
	
	AnimationTick();

	// opening trigger
	if (abs(m_PosTurret.x - heroPos.x) < SHOOT_DISTANCE && m_BehaviourState == BehaviourState::CLOSED) Open();

	ChangeAngle();

	// shooting trigger
	if (abs(m_PosTurret.x - heroPos.x) < SHOOT_DISTANCE) Shoot();
	
}