how to rotate a square accordingly to the mouse x and y?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
ivailobsu
Prole
Posts: 1
Joined: Sat Jul 18, 2020 9:33 am

how to rotate a square accordingly to the mouse x and y?

Post by ivailobsu »

So i have this square and i want to rotate it, so that it faces the mouse position, but im not sure how to do it. I have gotten the mouse x and y already.
User avatar
ReFreezed
Party member
Posts: 612
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

Re: how to rotate a square accordingly to the mouse x and y?

Post by ReFreezed »

Code: Select all

local angle = math.atan2(y, x)
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests