public override void Draw(SpriteBatch sprite_batch) { for (int i = 0; i < this.Items.Count; i++) { float layer = (int)H_Drawing.DrawLayers.Foreground / 100.0f + M_MapManager.GetWorldDepth(this.Items[i].Position); H_Drawing.DrawSprite(sprite_batch, this.Items[i].Icon, this.Items[i].Position, layer); } }
/// <summary> /// Draws the character to the screen. /// </summary> /// <param name="sprite_batch">The sprite batch reference.</param> public override void Draw(SpriteBatch sprite_batch) { UpdateAnimationFrame(); //Old drawing, no layer inclusion //sprite_batch.Draw //( // texture: SpriteSheet, // sourceRectangle: new Rectangle(current_frame * sprite_width, (int)direction * sprite_height, sprite_width, sprite_height), // color: Color.White, // position: Helpers.H_Math.VectorLevel(Position) //); Rectangle cutout = new Rectangle(current_frame * sprite_width, (int)direction * sprite_height, sprite_width, sprite_height); Vector2 new_position = Helpers.H_Math.VectorLevel(Position); float layer = ((int)this.DrawLayer / 100.0f) + M_MapManager.GetWorldDepth(GetCenterpoint()); sprite_batch.Draw(SpriteSheet, new_position, cutout, Color.White, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, layer); }