本文整理汇总了C#中Sprite.LoadContent方法的典型用法代码示例。如果您正苦于以下问题:C# Sprite.LoadContent方法的具体用法?C# Sprite.LoadContent怎么用?C# Sprite.LoadContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sprite
的用法示例。
在下文中一共展示了Sprite.LoadContent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Shaman
public Shaman(GameWorld gameWorld)
: base(gameWorld)
{
Graphic.Layer = 1;
Graphic = new Sprite(gameWorld.ContentManager);
Graphic.LoadContent("gfx/Avatar/shaman/shaman");
Graphic.Offset = new Vector2(Graphic.Texture.Width / 2 - 50, Graphic.Texture.Height / 2 - 60);
animations = new ShamanAnimations(Graphic.Texture);
BuildPhysicalBody();
}
示例2: LoadContent
/*
* Load graphics content for the game.
*/
public override void LoadContent()
{
if (content == null)
{
content = new ContentManager(ScreenManager.Game.Services, "Content/GraphicsContent");
}
gameFont = content.Load<SpriteFont>("menufont");
/*
* Adding the background
*/
mBackgroundOne = new Sprite();
mBackgroundOne.LoadContent(this.content, "Background01");
mBackgroundOne.Position = new Vector2(0, 0);
mBackgroundOne.Scale = 1;
/*
* Adding the projectile penguin
*/
nerd = new Nerd();
nerd.LoadContent(this.content, 150, 600);
ammukset = nerd.ammukset;
/*
* Adding the walls and targets
*/
target = new Sika();
target.Scale = 0.3F;
target.value = 3;
target.LoadContent(this.content, 800, 500, "birdy");
target2 = new Sika();
target2.Scale = 0.3F;
target2.value = 5;
target2.LoadContent(this.content, 700, 600, "birdy");
target3 = new Sika();
target3.Scale = 0.3F;
target3.value = 7;
target3.LoadContent(this.content, 700, 300, "birdy");
target4 = new Sika();
target4.Scale = 0.3F;
target4.value = 10;
target4.LoadContent(this.content, 480, 550, "birdy");
target5 = new Sika();
target5.Scale = 0.3F;
target5.value = 8;
target5.LoadContent(this.content, 500, 200, "birdy");
wall = new Tile();
wall.LoadContent(this.content, 400, 500, "tile2");
wall.LoadContent(this.content, 400, 500, "tile3");
wall2 = new Tile();
wall2.LoadContent(this.content, 400, 530, "tile3");
wall3 = new Tile();
wall3.LoadContent(this.content, 400, 560, "tile3");
wall4 = new Tile();
wall4.LoadContent(this.content, 400, 590, "tile3");
wall5 = new Tile();
wall5.LoadContent(this.content, 400, 620, "tile3");
wall6 = new Tile();
wall6.LoadContent(this.content, 400, 650, "tile3");
wall7 = new Tile();
wall7.LoadContent(this.content, 400, 680, "tile3");
/*
* A super cool one second wait when the load is finished to make the illusion our game is heavy
*/
Thread.Sleep(1000);
ScreenManager.Game.ResetElapsedTime();
}
示例3: LoadContent
/// <summary>
/// Load graphics content for the game.
/// </summary>
public override void LoadContent()
{
if (content == null)
{
content = new ContentManager(ScreenManager.Game.Services, "Content/GraphicsContent");
}
gameFont = content.Load<SpriteFont>("menufont");
// spriteBatch = new SpriteBatch(GraphicsDevice);
//määritellään background
mBackgroundOne = new Sprite();
mBackgroundOne.LoadContent(this.content, "Background01");
mBackgroundOne.Position = new Vector2(0, 0);
mBackgroundOne.Scale = 1;
//määrritellään tuxi
nerd = new Nerd();
nerd.LoadContent(this.content);
nerd.Position.X = 800;
nerd.Position.Y = 300;
//tarkoitus tehdä tästä "possu"
target = new Sika();
target.LoadContent(this.content);
target.Position.X = 900;
target.Position.Y = 600;
// mBackgroundTwo.LoadContent(this.content, "Background02");
// mBackgroundTwo.Position = new Vector2(mBackgroundOne.Position.X + mBackgroundOne.Size.Width, 0);
//mBackgroundThree.LoadContent(this.Content, "Background03");
//mBackgroundThree.Position = new Vector2(mBackgroundTwo.Position.X + mBackgroundTwo.Size.Width, 0);
//mBackgroundFour.LoadContent(this.Content, "Background04");
//mBackgroundFour.Position = new Vector2(mBackgroundThree.Position.X + mBackgroundThree.Size.Width, 0);
//mBackgroundFive.LoadContent(this.Content, "Background05");
//mBackgroundFive.Position = new Vector2(mBackgroundFour.Position.X + mBackgroundFour.Size.Width, 0);
//lintu
//tämän voi poistaa lopullisesta, mutta antaa paremman fiiliksen kun load screeni näkyy hetken :)
Thread.Sleep(1000);
// once the load has finished, we use ResetElapsedTime to tell the game's
// timing mechanism that we have just finished a very long frame, and that
// it should not try to catch up.
ScreenManager.Game.ResetElapsedTime();
//vanhasta luokasta revitut dädät:
// Create a new SpriteBatch, which can be used to draw textures.
//mitä näillä tehdään?
//mSprite.LoadContent(this.Content, "birdy");
//mSprite.Position = new Vector2(125, 245);
//mSpriteTwo.LoadContent(this.Content, "birdy");
//mSpriteTwo.Position.X = 300;
//mSpriteTwo.Position.Y = 300;
}