Exemplo n.º 1
0
void NPC::Shoot(AttackType projectile)
{
	switch (projectile)	{
	case eFireball: {
		ShootMissile();
		break;
	}
	case eBlueFlame: {
		ShootArrow();
		break;
	}
	default:
		break;
	}
}
Exemplo n.º 2
0
void CCrossBow::Attack(void)
{
	SetAttacking(true);
	CPlayer::GetInstance()->SetAttackDamage(15);
	if(m_fSlashTimer == 0.0f)
	{
		if(CPlayer::GetInstance()->m_bPhilSpecialAttack == false)
		{
			GetSound()->Play();
			ShootArrow();
		}
		else
		{
			AUDIO->SFXPlaySound(m_sndCharged);
		}
	}
}
void AMMO_Character::AnimationHandler()
{
	AnimInstance->bIsMoving = ((MoveX != 0 || MoveY != 0) && !bIsAttacking && !bIsShieldBlocking);
	AnimInstance->bIsGrounded = GetCharacterMovement()->IsMovingOnGround();
	if (AnimInstance->bShootArrowNow)
	{
		AnimInstance->bShootArrowNow = false;
		ShootArrow();
	}


	if(!bIsWarrior && HandArrow)
	HandArrow->SetVisibility(AnimInstance->bIsHandArrowVisible);

	bIsAttacking = (AnimInstance->Montage_IsPlaying(AttackMontage) || AnimInstance->Montage_IsPlaying(SecondAttackMontage));

}
Exemplo n.º 4
0
void Humanoid::HandleInput()
{

	// CHANGED
	// added this check so that AI controlled entities don't try to handle input
	// Rolf, 6-9-04
	if (cPlayer != CHARACTER_PLAYER1 && cPlayer != CHARACTER_PLAYER2)
		return;

	Vector vMoveDirection(0.0f, 0.0f, 0.0f);

	Vector vCamZ=Game::pWorld->pCamera->GetZ();
	Vector vCamX=Game::pWorld->pCamera->GetX();

	float fXRot=0, fYRot=0;
		
	//get analog stick input
	if (pActionMap->GetJoystick())
	{
		vMoveDirection.fComp[0]=(float)pActionMap->GetJoystick()->CheckImmediateInput(JOYSTICK_AXIS_LX);
		vMoveDirection.fComp[2]=(float)-pActionMap->GetJoystick()->CheckImmediateInput(JOYSTICK_AXIS_LY);

		//manual deadzoning
		if(vMoveDirection.fComp[0]<DEBUG_DEADZONE&&vMoveDirection.fComp[0]>-DEBUG_DEADZONE)
			vMoveDirection.fComp[0]=0;

		if(vMoveDirection.fComp[2]<DEBUG_DEADZONE&&vMoveDirection.fComp[2]>-DEBUG_DEADZONE)
			vMoveDirection.fComp[2]=0;

		//analog camera controls
		fXRot=(float)pActionMap->GetJoystick()->CheckImmediateInput(JOYSTICK_AXIS_RX)*0.001f*90;
		fYRot=(float)pActionMap->GetJoystick()->CheckImmediateInput(JOYSTICK_AXIS_RY)*0.001f*90;
	}

	//Check keyboard movement input
	if (DirectInput::GetKeyboard()->CheckImmediateInput(DIK_A))
		vMoveDirection.fComp[0]=-1000;
	if (DirectInput::GetKeyboard()->CheckImmediateInput(DIK_D))
		vMoveDirection.fComp[0]=1000;
	if (DirectInput::GetKeyboard()->CheckImmediateInput(DIK_W))
		vMoveDirection.fComp[2]=1000;
	if (DirectInput::GetKeyboard()->CheckImmediateInput(DIK_S))
		vMoveDirection.fComp[2]=-1000;

	//Handle character movement
	vMoveDirection*=0.007f;	
	vMoveDirection=vCamZ*vMoveDirection.fComp[2]+vCamX*vMoveDirection.fComp[0];
	MoveInDirection(&vMoveDirection);

	//digital camera control
	if(pActionMap->CheckAction(iActionArray[HUMANOID_SWING_CAMERA_LEFT], DEVICE_ALL, false))//if (DirectInput::GetKeyboard()->CheckImmediateInput(DIK_LEFT))
		fXRot=90;
	if(pActionMap->CheckAction(iActionArray[HUMANOID_SWING_CAMERA_RIGHT], DEVICE_ALL, false))////if (DirectInput::GetKeyboard()->CheckImmediateInput(DIK_RIGHT))
		fXRot=-90;

	//Handle camera movement
	Game::pWorld->pCamera->RotateY(fXRot*Timer::GetElapsedTime());
//	RenderManager::GetCamera(cPlayer)->RotateLocalX(fYRot*Timer::GetElapsedTime());

	//Handle jump
	if(bJump&&pActionMap->CheckAction(iActionArray[HUMANOID_JUMP], DEVICE_ALL, false))
		Jump();

	//Handle switching arrows
	if(pActionMap->CheckAction(iActionArray[HUMANOID_SWITCH_ARROW], DEVICE_ALL, true))
	{
		iSelectedArrow++;
		if(iSelectedArrow>=Arrow::ARROW_TYPE_NUM)
			iSelectedArrow=0;
	}

	//Handle arrow firing
	bIsCharging=false;
	if(bShootArrow&&pActionMap->CheckAction(iActionArray[HUMANOID_SHOOT_ARROW], DEVICE_ALL, false))
	{
		bIsCharging=true;
		fChargeTime+=Timer::GetElapsedTime();
	}
		
	if(!bIsCharging&&fChargeTime)
	{
		ShootArrow(fChargeTime);
		fChargeTime=0;
	}
}
void AMMO_Character::Multicast_ShootArrow_Implementation() 
{
	ShootArrow();
}
Exemplo n.º 6
0
void UpdateMonster(Entity *self)
{
  int *frames;
  if(self->state == MS_Deadbody)
  {
    return;
  }
  if(self->state == MS_Dead)
  {
    /*run death animation*/
    if((self->frame < deadframes[0])||(self->frame > deadframes[1]))
    {
      self->frame = deadframes[0] - 1;
    }
    self->frame++;
    if(self->frame != deadframes[1])return;
    if(GetObjKey(self->data,"persists",NULL))
    {
      SetPlayerProgress(level.name,self->name, self->objindex,"dead");
    }
    /*spawndeadbody, unless nocorpse*/
    self->state = MS_Deadbody;
    self->update = NULL;
    self->think = NULL;
    self->solid = 0;
    self->FloorDraw = 1;
    self->activate = NULL;
    return;
  }
  if(self->attacking)
  {
    /*this is going to become a lot more robust*/
    self->attackframe++;
      switch(self->attacktype)
      {
        case AT_Slash:
          frames = slashframes;
          if(self->attackframe >=4)
          {
            if((self->attackframe > (8 * self->attackspeed))||(Slash(self,self->p,self->targetpoint,self->attackrange,35,-35,2, self->attackframe/8.0, 1, 1, self->damagetype)))
            {
              self->attacking = 0;
              AddDelays(self,8);
              self->Rcd = 8  + (8 * self->attackspeed);
              self->Acd = 4 + (4 * self->attackspeed);
            }
          }
          break;
        case AT_Crush:
          frames = crushframes;
          if(self->attackframe >=4)
          {
            if((self->attackframe > (8 * self->attackspeed))||(Crush(self,self->p,self->targetpoint,self->attackrange,35,-35,2, self->attackframe/8.0, 1, 1, self->damagetype)))
            {
              self->attacking = 0;
              AddDelays(self,8);
              self->Rcd = 8  + (8 * self->attackspeed);
              self->Acd = 4 + (4 * self->attackspeed);
            }
          }
          break;
        case AT_Stab:
          frames = stabframes;
          if(self->attackframe >=4)
          {
            if((self->attackframe > (8 * self->attackspeed))||(Stab(self,self->p,self->targetpoint,self->attackrange,2, self->attackframe/8.0, 1, 1, self->damagetype)))
            {
              self->attacking = 0;
              AddDelays(self,8);
              self->Rcd = 8  + (8 * self->attackspeed);
              self->Acd = 4 + (4 * self->attackspeed);
            }
          }
          break;
        case AT_Shoot:
          frames = shootframes;
          if((int)self->attackframe == 6)
          {
            ShootArrow(self);
          }
          if(self->attackframe > 8)
          {
            self->attacking = 0;
            AddDelays(self,8);
            self->Rcd = 8  + (8 * self->attackspeed);
            self->Acd = 4 + (4 * self->attackspeed);
          }
          break;
      }

    self->frame = frames[0] + ((frames[1] - frames[0])*(self->attackframe/(8 * self->attackspeed)));
  }
  else if(self->guard)
  {
    /*using the shield, Set left arm sprite to guard*/
    self->frame = 1;
  }
  else
  {
    /*when idle*/
    if(self->frame < idleframes[0])self->frame = idleframes[0];
    else if (self->frame > idleframes[1])self->frame = idleframes[0];
    else
    {
      self->frame = self->frame + 0.2;
    }
  }
  if(RelativeSize(self->v.x, self->v.y) > 0)
  {
    UpdateEntityPosition(self,NULL);
  }
  CoolDowns(self);
}