topdown rotations
Posted: Sun Oct 13, 2019 5:22 am
Hey guys so im kinda stuck on a problem with getting a topdown image to rotate the right way.
Heres my image. I'm trying to get the image to rotate towards the middle of the screen no matter where it comes from.
I already have the ships moving towards the earth and calculate the angle from whatever coords they spawn at using
32 being height and width of the image.
I then plug that into as such
However, without adding i cannot get the ship to face the direction its going.
Heres my image. I'm trying to get the image to rotate towards the middle of the screen no matter where it comes from.
I already have the ships moving towards the earth and calculate the angle from whatever coords they spawn at using
Code: Select all
local angle = math.atan2((Earth.Y + Earth.Height / 2)- (RaidGroup[i][4] + 32 / 2), (Earth.X + Earth.Width / 2)- (RaidGroup[i][3] + 32 / 2))
I then plug that into
Code: Select all
love.graphics.draw()
Code: Select all
for i = 1,#RaidGroup do
love.graphics.draw(Aliens.FrigateImages[1], RaidGroup[i][3], RaidGroup[i][4], RaidGroup[i][8], 1, 1, 32/2, 32/2)
end
However, without adding
Code: Select all
angle = angle + math.rad(136)