public void Draw(SpriteBatch spriteBatch) { Rectangle sourceRectangle; Rectangle destinationRectangle; if (currentFrame < 3) { sourceRectangle = new Rectangle(0, 0, 96, 162); destinationRectangle = new Rectangle((int)GlobalDefinitions.Position.X, (int)GlobalDefinitions.Position.Y, 96, 162);//I don't understand why the width of destinationRectangle has to be like this. } else if (3 <= currentFrame && currentFrame < 6) { sourceRectangle = new Rectangle(96, 0, 96, 162); destinationRectangle = new Rectangle((int)GlobalDefinitions.Position.X, (int)GlobalDefinitions.Position.Y, 96, 162); } else if (6 <= currentFrame && currentFrame < 9) { sourceRectangle = new Rectangle(192, 0, 96, 162); destinationRectangle = new Rectangle((int)GlobalDefinitions.Position.X, (int)GlobalDefinitions.Position.Y, 96, 162); } else { sourceRectangle = new Rectangle(288, 0, 96, 162); destinationRectangle = new Rectangle((int)GlobalDefinitions.Position.X, (int)GlobalDefinitions.Position.Y, 96, 162); } spriteBatch.Draw(Texture2DStorage.GetDownWoodenSwordLinkSpriteSheet(), destinationRectangle, sourceRectangle, Color.White);//use Texture2DStorage class to load texture2D }
public void Draw(SpriteBatch spriteBatch, Vector2 Position) { Rectangle sourceRectangle; if (currentFrame < 3) { sourceRectangle = new Rectangle(0, 0, 96, 162); destinationRectangle = new Rectangle((int)GlobalDefinitions.Position.X, (int)GlobalDefinitions.Position.Y, 96, 162); } else if (3 <= currentFrame && currentFrame < 6) { sourceRectangle = new Rectangle(96, 0, 96, 162); destinationRectangle = new Rectangle((int)GlobalDefinitions.Position.X, (int)GlobalDefinitions.Position.Y, 96, 162); } else if (6 <= currentFrame && currentFrame < 9) { sourceRectangle = new Rectangle(192, 0, 96, 162); destinationRectangle = new Rectangle((int)GlobalDefinitions.Position.X, (int)GlobalDefinitions.Position.Y, 96, 162); } else { sourceRectangle = new Rectangle(288, 0, 96, 162); destinationRectangle = new Rectangle((int)GlobalDefinitions.Position.X, (int)GlobalDefinitions.Position.Y, 96, 162); } spriteBatch.Draw(Texture2DStorage.GetDownWoodenSwordLinkSpriteSheet(), destinationRectangle, sourceRectangle, Color.White);//use Texture2DStorage class to load texture2D if (currentFrame == totalFrame) { Link.State.Stop(); } }
public void Draw(SpriteBatch spriteBatch) { if (exist) { GetSprite.Draw(Texture2DStorage.GetHeartContainerSpriteSheet(), spriteBatch, Position); } }
public void Draw(SpriteBatch spriteBatch) { if (exist) { GetSprite.Draw(Texture2DStorage.GetTriforceSpriteSheet(), spriteBatch, Position); } }
public void Draw(SpriteBatch spriteBatch, Vector2 Position) { Rectangle sourceRectangle; Texture2D Texture = Texture2DStorage.GetBombSpriteSheet(); if (currentFrame == 0) { sourceRectangle = new Rectangle(0, 0, 16, Texture.Height); destinationRectangle = new Rectangle((int)Position.X+10, (int)Position.Y-10, 40, 80); } else { sourceRectangle = new Rectangle(16 + (Texture.Width - 16)/3*(currentFrame-1), 0, (Texture.Width - 16)/3, Texture.Height); destinationRectangle = new Rectangle((int)Position.X, (int)Position.Y, 60, 60); } spriteBatch.Draw(Texture, destinationRectangle, sourceRectangle, Color.White);//use Texture2DStorage class to load texture2D }
public void Draw(SpriteBatch spriteBatch, Vector2 Position) { Rectangle sourceRectangle = new Rectangle(0, 0, 96, 96); Rectangle destinationRectangle = new Rectangle((int)GlobalDefinitions.Position.X, (int)GlobalDefinitions.Position.Y, 96, 96); //use texture2dStorage to get the texture2d of the sprite spriteBatch.Draw(Texture2DStorage.GetUpIdleLinkSpriteSheet(), destinationRectangle, sourceRectangle, Color.White); }
public void Draw(SpriteBatch spriteBatch, Vector2 Position) { if (!die) { this.GetSprite.Draw(Texture2DStorage.GetRightMovingAquamentusSpriteSheet(), spriteBatch, Position); } else { this.GetSprite.Draw(Texture2DStorage.GetDeathSpriteSheet(), spriteBatch, Position); } }
public void Draw(SpriteBatch spriteBatch, Vector2 Position) { if (!die) { this.GetSprite.Draw(Texture2DStorage.GetDownMovingRedGoriyaSpriteSheet(), spriteBatch, Position); } else { this.GetSprite.Draw(Texture2DStorage.GetDeathSpriteSheet(), spriteBatch, Position); } }
public void Draw(SpriteBatch spriteBatch, Vector2 Position) { if (!die) { this.GetSprite.Draw(Texture2DStorage.GetLeftMovingBlueOctorokSpriteSheet(), spriteBatch, Position); } else { this.GetSprite.Draw(Texture2DStorage.GetDeathSpriteSheet(), spriteBatch, Position); } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); AudioFactory.Instance.LoadAllAudio(this.Content); AudioFactory.Instance.PlayDungeonBGM(); Texture2DStorage.LoadAllTextures(this.Content); font = Content.Load <SpriteFont>("Score"); this.GameOver = new GameOver(); this.GameWin = new GameWin(); }
public void Draw(SpriteBatch spriteBatch) { GetSprite.Draw(Texture2DStorage.GetDownUseItemLinkSpriteSheet(), spriteBatch, GlobalDefinitions.Position); if (Link.Item == 1) { this.game.ProjectileFactory.AddArrow(GlobalDefinitions.Position, new Vector2(0, 1)); } if (Link.Item == 2) { this.game.ProjectileFactory.AddBomb(GlobalDefinitions.Position, new Vector2(0, 1)); } if (Link.Item == 3) { this.game.ProjectileFactory.AddBoomer(GlobalDefinitions.Position, new Vector2(0, 1)); } }
public void Draw(SpriteBatch spriteBatch, Vector2 location) { Rectangle sourceRectangle; Rectangle destinationRectangle; if (currentFrame == 0) { sourceRectangle = new Rectangle(0, 0, 512, 525); destinationRectangle = new Rectangle((int)location.X, (int)location.Y, 512, 525); } else { sourceRectangle = new Rectangle(512, 0, 512, 525); destinationRectangle = new Rectangle((int)location.X, (int)location.Y, 512, 525); } spriteBatch.Draw(Texture2DStorage.GetUpMovingLinkSpriteSheet(), destinationRectangle, sourceRectangle, Color.White);//use Texture2DStorage class to load texture2D }
public virtual void Draw(SpriteBatch spriteBatch, Vector2 Position) { Rectangle sourceRectangle; if (currentFrame < 5) { sourceRectangle = new Rectangle(0, 0, 96, 96); destinationRectangle = new Rectangle((int)GlobalDefinitions.Position.X, (int)GlobalDefinitions.Position.Y, 96, 96); } else { sourceRectangle = new Rectangle(96, 0, 96, 96); destinationRectangle = new Rectangle((int)GlobalDefinitions.Position.X, (int)GlobalDefinitions.Position.Y, 96, 96); } spriteBatch.Draw(Texture2DStorage.GetUpMovingLinkSpriteSheet(), destinationRectangle, sourceRectangle, Color.White);//use Texture2DStorage class to load texture2D }
public void Draw(SpriteBatch spriteBatch) { if (exist) { if (Direction.X == (float)1) { GetSprite.Draw(Texture2DStorage.GetRightWoodenArrowSpriteSheet(), spriteBatch, Position); } else if (Direction.X == (float)-1) { GetSprite.Draw(Texture2DStorage.GetLeftWoodenArrowSpriteSheet(), spriteBatch, Position); } else if (Direction.Y == (float)1) { GetSprite.Draw(Texture2DStorage.GetDownWoodenArrowSpriteSheet(), spriteBatch, Position); } else if (Direction.Y == (float)-1) { GetSprite.Draw(Texture2DStorage.GetUpWoodenArrowSpriteSheet(), spriteBatch, Position); } } }
public void Draw(SpriteBatch spriteBatch) { GetSprite.Draw(Texture2DStorage.GetUpWoodenSwordLinkSpriteSheet(), spriteBatch, GlobalDefinitions.Position - new Vector2(0, 64)); }
public void Draw(SpriteBatch spriteBatch) { GetSprite.Draw(Texture2DStorage.GetRightWoodenSwordLinkSpriteSheet(), spriteBatch, GlobalDefinitions.Position); }
public void Draw(SpriteBatch spriteBatch) { GetSprite.Draw(Texture2DStorage.GetDownIdleLinkSpriteSheet(), spriteBatch, GlobalDefinitions.Position); }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(); this.dungeonlevel.Draw(spriteBatch); Link.State.Draw(spriteBatch); this.ProjectileFactory.Draw(spriteBatch); headSprite.Draw(Texture2DStorage.HeadExteriorSpriteSheet, spriteBatch, new Vector2(0, 1056)); if (Link.HeartContainer < 8) { for (int i = 0; i < Link.HeartContainer; i++) { EmptyBloodHeartSprite.Draw(Texture2DStorage.GetHeartNoBloodSpriteSheet(), spriteBatch, new Vector2(1056 + 48 * i, 1248)); } } else { for (int k = 0; k < 8; k++) { EmptyBloodHeartSprite.Draw(Texture2DStorage.GetHeartNoBloodSpriteSheet(), spriteBatch, new Vector2(1056 + 48 * k, 1248)); } for (int j = 0; j < Link.HeartContainer - 8; j++) { EmptyBloodHeartSprite.Draw(Texture2DStorage.GetHeartNoBloodSpriteSheet(), spriteBatch, new Vector2(1056 + 48 * j, 1296)); } } if (Link.Life < 16) { if (Link.Life % 2 == 0) { for (int i = 0; i < Link.Life / 2; i++) { FullBloodHeartSprite.Draw(Texture2DStorage.GetHeartFullBloodSpriteSheet(), spriteBatch, new Vector2(1056 + 48 * i, 1248)); } } else { for (int i = 0; i < Link.Life / 2; i++) { FullBloodHeartSprite.Draw(Texture2DStorage.GetHeartFullBloodSpriteSheet(), spriteBatch, new Vector2(1056 + 48 * i, 1248)); } HalfBloodHeartSprite.Draw(Texture2DStorage.GetHeartHalfBloodSpriteSheet(), spriteBatch, new Vector2(1056 + 48 * (Link.Life / 2), 1248)); } } else { if (Link.Life % 2 == 0) { for (int i = 0; i < 8; i++) { FullBloodHeartSprite.Draw(Texture2DStorage.GetHeartFullBloodSpriteSheet(), spriteBatch, new Vector2(1056 + 48 * i, 1248)); } for (int j = 0; j < Link.Life / 2 - 8; j++) { FullBloodHeartSprite.Draw(Texture2DStorage.GetHeartFullBloodSpriteSheet(), spriteBatch, new Vector2(1056 + 48 * j, 1296)); } } else { for (int i = 0; i < Link.Life / 2; i++) { FullBloodHeartSprite.Draw(Texture2DStorage.GetHeartFullBloodSpriteSheet(), spriteBatch, new Vector2(1056 + 48 * i, 1248)); } for (int j = 0; j < Link.Life / 2 - 8; j++) { FullBloodHeartSprite.Draw(Texture2DStorage.GetHeartFullBloodSpriteSheet(), spriteBatch, new Vector2(1056 + 48 * j, 1296)); } HalfBloodHeartSprite.Draw(Texture2DStorage.GetHeartHalfBloodSpriteSheet(), spriteBatch, new Vector2(1056 + 48 * ((Link.Life - 16) / 2), 1296)); } } spriteBatch.DrawString(font, Link.RupeeNumber.ToString(), new Vector2(720, 1210), Color.White, 0, font.MeasureString(Link.RupeeNumber.ToString()), 3.0f, SpriteEffects.None, 1f); spriteBatch.DrawString(font, Link.KeyNumber.ToString(), new Vector2(720, 1310), Color.White, 0, font.MeasureString(Link.KeyNumber.ToString()), 3.0f, SpriteEffects.None, 1f); spriteBatch.DrawString(font, Link.BombNumber.ToString(), new Vector2(720, 1360), Color.White, 0, font.MeasureString(Link.BombNumber.ToString()), 3.0f, SpriteEffects.None, 1f); if (paused) { this.InventoryMenu.Draw(spriteBatch, new Vector2(0, 0)); } if (Link.Life <= 0) { AudioFactory.Instance.StopDungeonBG(); this.GameOver.Draw(spriteBatch); } if (Link.TriforceNumber > 0) { AudioFactory.Instance.StopDungeonBG(); this.GameWin.Draw(spriteBatch); } spriteBatch.End(); base.Draw(gameTime); }