Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ DrawGhost()

void Terraria.Graphics.Renderers.LegacyPlayerRenderer.DrawGhost ( Camera camera,
Player drawPlayer,
Vector2 position,
float shadow = 0f )
inlineprivate

Definition at line 512 of file LegacyPlayerRenderer.cs.

513 {
514 byte mouseTextColor = Main.mouseTextColor;
515 SpriteEffects effects = ((drawPlayer.direction != 1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None);
516 Color immuneAlpha = drawPlayer.GetImmuneAlpha(Lighting.GetColor((int)((double)drawPlayer.position.X + (double)drawPlayer.width * 0.5) / 16, (int)((double)drawPlayer.position.Y + (double)drawPlayer.height * 0.5) / 16, new Color(mouseTextColor / 2 + 100, mouseTextColor / 2 + 100, mouseTextColor / 2 + 100, mouseTextColor / 2 + 100)), shadow);
517 immuneAlpha.A = (byte)((float)(int)immuneAlpha.A * (1f - Math.Max(0.5f, shadow - 0.5f)));
518 Rectangle value = new Rectangle(0, TextureAssets.Ghost.Height() / 4 * drawPlayer.ghostFrame, TextureAssets.Ghost.Width(), TextureAssets.Ghost.Height() / 4);
519 Vector2 origin = new Vector2((float)value.Width * 0.5f, (float)value.Height * 0.5f);
520 camera.SpriteBatch.Draw(TextureAssets.Ghost.Value, new Vector2((int)(position.X - camera.UnscaledPosition.X + (float)(value.Width / 2)), (int)(position.Y - camera.UnscaledPosition.Y + (float)(value.Height / 2))), value, immuneAlpha, 0f, origin, 1f, effects, 0f);
521 }
static byte Max(byte val1, byte val2)
Definition Math.cs:738
static Asset< Texture2D > Ghost

References Microsoft.Xna.Framework.Color.A, Terraria.Lighting.GetColor(), Terraria.Player.GetImmuneAlpha(), Terraria.GameContent.TextureAssets.Ghost, Terraria.Player.ghostFrame, Terraria.Entity.height, System.Math.Max(), Terraria.Main.mouseTextColor, Terraria.Entity.position, System.value, Microsoft.Xna.Framework.Graphics.Vector2, Terraria.Entity.width, Microsoft.Xna.Framework.Vector2.X, and Microsoft.Xna.Framework.Vector2.Y.

Referenced by Terraria.Graphics.Renderers.LegacyPlayerRenderer.DrawPlayerFull().