当前位置: 首页>>代码示例>>C++>>正文


C++ Platform::sprite方法代码示例

本文整理汇总了C++中Platform::sprite方法的典型用法代码示例。如果您正苦于以下问题:C++ Platform::sprite方法的具体用法?C++ Platform::sprite怎么用?C++ Platform::sprite使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Platform的用法示例。


在下文中一共展示了Platform::sprite方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ScribbleEnemy

void
LevelObjects::startLevel()
{	
	for( CHUint i=2; i<20; ++i )
	{
      float locX = i * 15.0f;
		ScribbleEnemy* enemy1 = 
					new ScribbleEnemy(Vector3( locX, 12.0f, 0.0f), 
											Vector3(0.0f, 0.0f, 0.0f), 
											CDH::Rectangle(4.0f, 4.0f), 2);
		ScribbleEnemy* enemy2 = 
					new ScribbleEnemy(Vector3( locX + 1.0f, 12.0f, 0.0f), 
											Vector3(0.0f, 0.0f, 0.0f), 
											CDH::Rectangle(4.0f, 4.0f), 2);
		ScribbleEnemy* enemy3 = 
					new ScribbleEnemy(Vector3( locX + 2.0f, 12.0f, 0.0f), 
											Vector3(0.0f, 0.0f, 0.0f), 
											CDH::Rectangle(4.0f, 4.0f), 2);
		enemy1->sprite()->addAnimation("walk", g_scribbleManAnimation);
		enemy2->sprite()->addAnimation("walk", g_scribbleManAnimation);
		enemy3->sprite()->addAnimation("walk", g_scribbleManAnimation);
		m_data->objects.push_back(enemy1);
		m_data->objects.push_back(enemy2);
		m_data->objects.push_back(enemy3);
	}

	for( CHUint i=1; i<10; ++i )
	{
      ScribbleBoss *boss = 
			new ScribbleBoss(Vector3( i * 25.0f, 12.0f, 0.0f), 
								  Vector3(0.0f, 0.0f, 0.0f), 
								  CDH::Rectangle(9.0f, 18.0f), 20);
      boss->sprite()->addAnimation("walk", g_scribbleManAnimation);
      m_data->objects.push_back( boss );
	}

   Level1Boss *endBoss = 
      new Level1Boss(Vector3( 300.0f, 12.0f, 0.0f), 
                     Vector3(0.0f, 0.0f, 0.0f), 
                     CDH::Rectangle(6.0f, 10.0f), 
                     m_engine);
   endBoss->sprite()->addAnimation("walk", g_scribbleBossAnimation);
   m_data->objects.push_back( endBoss );


	// load terrain objects
	{
		const float LedgeHeightLevel2  = -6.5f;
		const float LedgeHeightLevel3  = -1.5f;
		Platform* platform = 
			new Platform(Vector3(-20.0f, -13.0f, 0.0f), Vector3(0.0f, 0.0f, 0.0f), 
										Rectangle(1000.0f, 1.0f));
		platform->sprite()->addAnimation("basic", g_platformAnimation);
		m_data->objects.push_back(platform);

      
      for(CHUint i=0; i<20; ++i)
      {
			platform = 
			   new Platform(Vector3( float((i + 1) * 40), LedgeHeightLevel2, 0.0f), 
                         Vector3(0.0f, 0.0f, 0.0f), 
							    Rectangle(20.0f, 1.0f));
			platform->sprite()->addAnimation("basic", g_platformAnimation);
	      m_data->objects.push_back(platform);

			platform = 
			   new Platform(Vector3( float((i + 1) * 40 + 10), LedgeHeightLevel3, 0.0f), 
                                 Vector3(0.0f, 0.0f, 0.0f), 
										   Rectangle(5.0f, 1.0f));
			platform->sprite()->addAnimation("basic", g_platformAnimation);
	      m_data->objects.push_back(platform);
      }
	}
}
开发者ID:,项目名称:,代码行数:74,代码来源:


注:本文中的Platform::sprite方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。