Bad angle in my code I assume?

I get the photon to animate and move but its moving along the incorrect vector. ship[1] is at 500,500 and ship[2] is at 100,100. When ship1 fires its torp at ship 2 the torpedo moves off to the right of ship1. Ship2 is below and to the left so I have something wrong in angle calc. When I print out the value of the calculated angle it shows -27811! lol.

How can I get the firing angle/vector between the 2 sprites?

function Ship:fire()
    BattleMap.Photon1.x = BattleMap.Ship[BattleMap.ActiveShip].x
    BattleMap.Photon1.y = BattleMap.Ship[BattleMap.ActiveShip].y
    BattleMap.Photon1.angle = math.deg(math.atan2(BattleMap.Ship[BattleMap.TargetShip].y - BattleMap.Ship[BattleMap.ActiveShip].y, BattleMap.Ship[BattleMap.TargetShip].x) - BattleMap.Ship[BattleMap.ActiveShip].x) 
    print(BattleMap.Photon1.x..", "..BattleMap.Photon1.y.." angle = "..BattleMap.Photon1.angle)
end

As always thanks in advance for your time and help!
Gib

Nevermind, I see it now. Still relearning Trig :wink:

In case anyone is interested what I have now that is working:

function Ship:fire()
    BattleMap.Photon1.x = BattleMap.Ship[BattleMap.ActiveShip].x
    BattleMap.Photon1.y = BattleMap.Ship[BattleMap.ActiveShip].y

    xDiff = BattleMap.Ship[BattleMap.TargetShip].x - BattleMap.Ship[BattleMap.ActiveShip].x
    yDiff = BattleMap.Ship[BattleMap.TargetShip].y - BattleMap.Ship[BattleMap.ActiveShip].y 
    BattleMap.Photon1.angle = math.deg(math.atan2(xDiff, yDiff))

    print(BattleMap.Photon1.x..", "..BattleMap.Photon1.y.." angle = "..BattleMap.Photon1.angle)
end

I read an article about normalizing 2 points that helped and I found some syntax errors.

@Gib - nothing to do with your error, but to make your code a bit easier to read, you might try

function Ship:fire()
    local B = BattleMap --makes code more readable
    B.Photon1 = B.Ship[B.ActiveShip] --vectors can be subtracted
    local Diff = B.Ship[B.TargetShip] - B.Ship[B.ActiveShip] 
    B.Photon1.angle = math.deg(math.atan2(Diff.x, Diff.y))
    print(B.Photon1.." angle = "..B.Photon1.angle)
end

You might also try looking at the angleBetween function for vec2, which will do the trig for you