Exemplo n.º 1
0
projectile::projectile(float speedboost, Ogre::Vector2 acceleration, float heaviness) : 
           movableObject("projectile", heaviness) {
 // num++;
/*  this->acceleration = acceleration;
  acceleration.normalise();
  acceleration *= speedboost;
  this->accelerate(&acceleration);
  */
  
  this->speed += acceleration;
  acceleration.normalise();
  acceleration *= speedboost;
  this->speed += acceleration;
  
  this->ObjectName = "projectile";
}
Exemplo n.º 2
0
bool TottAIStateMove::Update(float dt){
	AnimationMsg anim_msg;
	anim_msg.id = m_animation;
	anim_msg.loop = true;
	m_messenger->Notify(MSG_ANIMATION_PLAY, &anim_msg);
	m_messenger->Notify(MSG_NODE_GET_POSITION, &m_current_position);
	Ogre::Vector2 pos(m_current_position.x, m_current_position.z);
	float distance = pos.distance(m_target_position);
	if (distance <= 1.0f){
		return true;
	}
	Ogre::Vector2 dir = m_target_position - pos;
	dir.normalise();
	Ogre::Vector3 new_dir(dir.x, 0.0f, dir.y);
	m_messenger->Notify(MSG_CHARACTER_CONTROLLER_SET_DIRECTION, &new_dir);
	return false;
}