In Terraria I often try to defeat spazmatism first, but when he transformed, his flamethrower killed me. What is easiest way to kill The Twins?
The Twins are, in my opinion, the toughest of the mechanical bosses (though the Destroyer is much tougher than it used to be). As such, I tend to take them on last. Here are a few strategies that I use to defeat them:
Set up a line (or lines) of wooden platforms in the air that you can jump up to and down from. The benefit of platforms over regular blocks is that ranged attacks can pass through them. I typically set up one arena for the all of the mechanical bosses: three levels of platforms, spaced about 20 blocks apart. Make sure you have campfires, heart lanterns, and wire up a heart statue (if you can find one) to four pressure plates (this will give you 4 hearts of healing every 10 seconds!).
I prefer using the Megashark with crystal bullets, as the splash damage from the crystal bullets helps tremendously. Chlorophyte bullets are another very useful option, thanks to their homing capability.
Adamantite or Titanium armor at the very minimum. Hallowed armor is even better. Since I like using the Megashark, I typically go for the ranged helmet type, so I get the range damage bonus. I believe the Hallowed armor even has a chance to not consume ammo, which is very important.
Stock up on potions: iron skin, thorns, regeneration, swiftness, bowls of soup, and heart-reach. Greater healing potions are very useful at this stage.
Focus on Spazmatism first; he's the more difficult of the two by far (has more defense and more life). Simply fly around, kiting the boss as possible. Again, moving fast is key. The first phase is easiest; once he transforms into the second stage, you've got to keep your distance! His flamethrower-like attack does a tremendous amount of damage, so avoid it at all costs. I personally fly in a figure-eight pattern, kiting him and keeping my distance, relying on my wings to float through the air. My platforms allow me to continue firing, and give me a chance to land to reset my wing's flight time.
Once Spasmatizm is down, do the same thing for Retinazer. Kite, keep your distance, and plug away with the Megashark. Ranged damage is your friend because you can keep your distance. The Retinazer fight is way easier once Spasmatizm is down.
And don't forget to quaff your healing potions during the fight! The heart statue will really help, if you can find one. +80 health every 10 seconds is never a bad thing.
Firstly you should start by building a skybridge, preferably out of platforms so that you are able to fall through it to dodge attacks. Next craft some campfires and place them along the bridge so you will receive its buff, while you should not rely on it to regenerate health it doesn't hurt to have (healing effect will also stack with the heart lantern). These will both help when when fighting Spazmatism as it will slow the effects of his cursed flame. If you can, try and purchase an ammo box as you will be using a ranged weapon for the fight and this will reduce bullet/arrow consumption
For equipment, you will want to have an adamantite armour tier equivalent or higher. Try and have a ranged weapon such as a mega shark or repeater, or a magic weapon such as the laser rifle or frost staff. weapons are really up to you and your preferred play style so use what ever weapon you feel comfortable with. Wings are a must, these will help to dodge the twins attacks, combined with the spectre boots, you will be able to escape if you are running low on health. Practice dodging and using a hook to quick turn mid flight this will help immensely as you don't need to heal if you don't take damage! Other trinkets are up to your personal preference but try and have them reforged into warding or menacing as this will give you an extra 20 defence or 20% damage.
Finally potions, bring quite a few especially if you are using magic weapons, you won't want to run out of mana mid way through the fight.
Killing Spazmatism first means you wont have to deal with his cursed inferno for the whole of the fight where as killing Retinazer first will help if you aren't that good at dodging its' charge attacks and lasers.
At the end of the day it may take a few attempts for you to get a feel for the fight and to defeat the twins, but as long as you place all your money in a chest the only thing you are losing if you die are bullets and potions with isn't to much of an issue.
You only need Pallidium armor, a Megashark and Crystal Bullets. Build a long sky bridge, and summon them while running backwards with Hermes, spectre, lightning, frostspark, or and boots that make you run fast, while shooting at them. Shoot the one that is parallel to the sky bridge first, then the other. Place campfires and/or heart lanterns across your sky bridge as well. Make sure you have wings to turn around when you make it to the end of the sky bridge. The fight isn't very hard.