Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using Microsoft.Xna.Framework;
- using Microsoft.Xna.Framework.Graphics;
- using Terraria;
- using Terraria.ModLoader;
- using Terraria.ID;
- namespace FlailOverload.Projectiles
- {
- public class Projectile : ModProjectile
- {
- public override void SetDefaults()
- {
- projectile.name = "MetallicFlailProjectile";
- projectile.width = 28;
- projectile.height = 28;
- projectile.friendly = true;
- projectile.penetrate = -1;
- projectile.melee = true;
- projectile.aiStyle = 15;
- }
- public override bool PreDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Color lightColor)
- {
- Texture2D texture = ModLoader.GetTexture("FlailOverload/Projectiles/MetallicFlail_Chain");
- Vector2 position = projectile.Center;
- Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter;
- Microsoft.Xna.Framework.Rectangle? sourceRectangle = new Microsoft.Xna.Framework.Rectangle?();
- Vector2 origin = new Vector2((float)texture.Width * 0.5f, (float)texture.Height * 0.5f);
- float num1 = (float)texture.Height;
- Vector2 vector2_4 = mountedCenter - position;
- float rotation = (float)Math.Atan2((double)vector2_4.Y, (double)vector2_4.X) - 1.57f;
- bool flag = true;
- if (float.IsNaN(position.X) && float.IsNaN(position.Y))
- flag = false;
- if (float.IsNaN(vector2_4.X) && float.IsNaN(vector2_4.Y))
- flag = false;
- while (flag)
- {
- if ((double)vector2_4.Length() < (double)num1 + 1.0)
- {
- flag = false;
- }
- else
- {
- Vector2 vector2_1 = vector2_4;
- vector2_1.Normalize();
- position += vector2_1 * num1;
- vector2_4 = mountedCenter - position;
- Microsoft.Xna.Framework.Color color2 = Lighting.GetColor((int)position.X / 16, (int)((double)position.Y / 16.0));
- color2 = projectile.GetAlpha(color2);
- Main.spriteBatch.Draw(texture, position - Main.screenPosition, sourceRectangle, color2, rotation, origin, 1.35f, SpriteEffects.None, 0.0f);
- }
- }
- return true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement