コード例 #1
0
ファイル: Map.cpp プロジェクト: Noxalus/YAPOG
  void Map::AddDrawableDynamicObject (
    const yap::ID& worldID,
    yap::IDrawableDynamicWorldObject* drawableObject)
  {
    AddDrawableObject (drawableObject);

    drawableDynamicObjects_.Add (worldID, drawableObject);
  }
コード例 #2
0
ファイル: CProjectile.cpp プロジェクト: kretzmoritz/Archive
void CProjectile::init(float _x, float _y, int _parentID, bool _salve)
{
	ci_projectile_data = new CProjectileData();
	
	std::string sProjectileSound;
	sProjectileSound = ci_projectile_data->getSound(_parentID);

	if(!_salve)
	{
		sProjectileSound += ".wav";
		PlaySound(glDataBox->GetSoundBuffer(sProjectileSound), _parentID + 4); // Make sure sounds get played on different layers
	}
	else
	{
		sProjectileSound += "_salve.wav";
		PlaySound(glDataBox->GetSoundBuffer(sProjectileSound), _parentID + 4);
	}

	m_fStartX = _x;
	m_fStartY = _y;

	m_iParent = _parentID;
	m_bSalve = _salve;
	setBlocked(-1);
	
	setScale(-1.0f, 1.0f);
	setPosition(_x, _y);
	setOrigin(ci_projectile_data->getOrigin(m_iParent).x, ci_projectile_data->getOrigin(m_iParent).y);

	m_collision = new pwCollisionRect();
	m_collision->SetSize((float)ci_projectile_data->getSize(m_iParent).width, (float)ci_projectile_data->getSize(m_iParent).height);
	AddCollisionObject(ID_CO_PROJECTILE, m_collision);

	SetGravityMultiplier(ci_projectile_data->getGravity(m_iParent) * (CBeatSystem::GetBPM() * 1.5f) / 80.0f); // Use BMP to modify gravity to a certain extent -> projectile needs to hit coloss
	m_visual.SetFramesPerSecond(ci_projectile_data->getAnimationSpeed(m_iParent));
	
	velocity temp = calculateForce(m_iParent);
	SetStartVelocity(temp.xVel, temp.yVel);

	m_visual.setTexture(*glDataBox->GetTexture(ci_projectile_data->getTexture(m_iParent)));
	m_visual.SetFrameSize(ci_projectile_data->getSize(m_iParent).width, ci_projectile_data->getSize(m_iParent).height);
	m_visual.SetTotalFrames(ci_projectile_data->getFrames(m_iParent));
	
	m_visual.AddAnimation(P_ANIM_NORMAL, ci_projectile_data->getAnimation(m_iParent).normalStart, ci_projectile_data->getAnimation(m_iParent).normalEnd);
	m_visual.AddAnimation(P_ANIM_DEATH, ci_projectile_data->getAnimation(m_iParent).deathStart, ci_projectile_data->getAnimation(m_iParent).deathEnd);
	m_visual.SetCurrentAnimation(P_ANIM_NORMAL);

	AddDrawableObject(ID_DO_PROJECTILE, &m_visual);

	m_vProjectiles.push_back(this);
	glLogics->RegisterGameObject(this, ID_GS_PLAY);
}