koiee
Terrarian
Making a custom laser projectile is pretty difficult, so you might need to check out the example last prism from exampleMod.I'm trying to have my laser shoot from the sky straight down on the mouses location but I can't figure it out and I can't find it on the doc.
tModLoader/ExampleMod/Content/Projectiles/ExampleLastPrismBeam.cs at 1.4.4 · tModLoader/tModLoader
Firstly, you need to make a sprites sheet for your laser (start, middle, end)
In the Item:
Now, you can fetch the Vector2 for the mouse position with Main.MouseWorld in the item's Shoot() method. Offset the position into the sky, add random values, and spawn in the projectiles.
In the Projectile's AI():
Laser projectiles is pretty much the same as normal projectiles. The 2 additions with lasers are overriding PreDraw() and Collision().
You can make a custom collision check for laser by overriding Collision() and return Collision.CheckAABBvLineCollision() instead.
Predraw() is more difficult though as you need to make a custom laser draw method with:
public static void CustomLaserDraw(int stage, Vector2 currentPosition, float distanceLeft, Rectangle lastFrame, out float distCovered, out Rectangle frame, out Vector2 origin, out Color color)
If you are just starting with the modding, I think you should just try other stuff first.