From 512fba3cebaaaa02bc8d4bad771c7310fced2790 Mon Sep 17 00:00:00 2001 From: Dominic Date: Fri, 17 Sep 2021 12:06:34 -0500 Subject: [PATCH] Fixed lab seeker afterimages --- Projectiles/Typeless/CyanLabSeeker.cs | 2 +- Projectiles/Typeless/GreenLabSeeker.cs | 2 +- Projectiles/Typeless/PurpleLabSeeker.cs | 2 +- Projectiles/Typeless/RedLabSeeker.cs | 8 +++++++- Projectiles/Typeless/YellowLabSeeker.cs | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Projectiles/Typeless/CyanLabSeeker.cs b/Projectiles/Typeless/CyanLabSeeker.cs index bd33008fc6..41d77694d6 100644 --- a/Projectiles/Typeless/CyanLabSeeker.cs +++ b/Projectiles/Typeless/CyanLabSeeker.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D texture = Main.projectileTexture[projectile.type]; - if (Time > 80f) + if (Time > 80f && projectile.ai[1] == 0f) { for (int i = 0; i < 24; i += 2) { diff --git a/Projectiles/Typeless/GreenLabSeeker.cs b/Projectiles/Typeless/GreenLabSeeker.cs index b64810bfd2..e4cecb13aa 100644 --- a/Projectiles/Typeless/GreenLabSeeker.cs +++ b/Projectiles/Typeless/GreenLabSeeker.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D texture = Main.projectileTexture[projectile.type]; - if (Time > 80f) + if (Time > 80f && projectile.ai[1] == 0f) { for (int i = 0; i < 24; i += 2) { diff --git a/Projectiles/Typeless/PurpleLabSeeker.cs b/Projectiles/Typeless/PurpleLabSeeker.cs index 6f0b1b0a43..2d906043c7 100644 --- a/Projectiles/Typeless/PurpleLabSeeker.cs +++ b/Projectiles/Typeless/PurpleLabSeeker.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D texture = Main.projectileTexture[projectile.type]; - if (Time > 80f) + if (Time > 80f && projectile.ai[1] == 0f) { for (int i = 0; i < 24; i += 2) { diff --git a/Projectiles/Typeless/RedLabSeeker.cs b/Projectiles/Typeless/RedLabSeeker.cs index da6c4d8711..f7fceae72b 100644 --- a/Projectiles/Typeless/RedLabSeeker.cs +++ b/Projectiles/Typeless/RedLabSeeker.cs @@ -31,6 +31,8 @@ namespace CalamityMod.Projectiles.Typeless public static void Behavior(Projectile projectile, Vector2 destination, Color dustColor, ref float time) { + projectile.ai[1] = 0f; + if (time < 45f) projectile.velocity = Vector2.UnitY * Utils.InverseLerp(0f, 25f, time, true) * Utils.InverseLerp(30f, 25f, time, true) * -4.5f; else if (time < 80f) @@ -39,7 +41,11 @@ namespace CalamityMod.Projectiles.Typeless { if (projectile.WithinRange(destination, 420f)) { + projectile.ai[1] = 1f; projectile.velocity = Vector2.Lerp(projectile.velocity, Vector2.UnitY * (float)Math.Sin((time - 80f) / 24f) * 2.5f, 0.15f); + + if (!projectile.WithinRange(destination, 30f)) + projectile.Center = projectile.Center.MoveTowards(destination, 10f); projectile.rotation *= 0.95f; projectile.Center = Vector2.Lerp(projectile.Center, destination, 0.1f); } @@ -85,7 +91,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D texture = Main.projectileTexture[projectile.type]; - if (Time > 80f) + if (Time > 80f && projectile.ai[1] == 0f) { for (int i = 0; i < 24; i += 2) { diff --git a/Projectiles/Typeless/YellowLabSeeker.cs b/Projectiles/Typeless/YellowLabSeeker.cs index 231521a5c6..c73af6ad85 100644 --- a/Projectiles/Typeless/YellowLabSeeker.cs +++ b/Projectiles/Typeless/YellowLabSeeker.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D texture = Main.projectileTexture[projectile.type]; - if (Time > 80f) + if (Time > 80f && projectile.ai[1] == 0f) { for (int i = 0; i < 24; i += 2) {