Title says it all. How can i turn an image?
PS: I just realised this is the 666th thread
Turning an image
Turning an image
I can't come up with a good signature!
- nevon
- Commander of the Circuloids
- Posts: 938
- Joined: Thu Feb 14, 2008 8:25 pm
- Location: Stockholm, Sweden
- Contact:
Re: Turning an image
The fourth argument in love.graphics.draw is rotation, where the unit used is radians.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Turning an image
In case you don't know how radians work: 0 = normal, math.pi/2 = 90°, math.pi = 180°, etc.
Help us help you: attach a .love.
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: Turning an image
You could also do this:Robin wrote:In case you don't know how radians work: 0 = normal, math.pi/2 = 90°, math.pi = 180°, etc.
Code: Select all
math.tau = math.pi * 2
math.tau -- 360 deg
math.tau / 2 -- 180 deg
math.tau / 4 -- 90 deg
- nevon
- Commander of the Circuloids
- Posts: 938
- Joined: Thu Feb 14, 2008 8:25 pm
- Location: Stockholm, Sweden
- Contact:
Re: Turning an image
You could also do this:BlackBulletIV wrote:You could also do this:Robin wrote:In case you don't know how radians work: 0 = normal, math.pi/2 = 90°, math.pi = 180°, etc.Much easier to remember for me. (By the way, I'm using Tau from here: http://tauday.com)Code: Select all
math.tau = math.pi * 2 math.tau -- 360 deg math.tau / 2 -- 180 deg math.tau / 4 -- 90 deg
Code: Select all
math.rad(90) -- 90 deg
Re: Turning an image
Oh thanks. Now just one thing yet, how can i toggle image visibility?
I can't come up with a good signature!
Re: Turning an image
Just don't draw it.
Re: Turning an image
But if it already is in the screen and i want to get rid of it?
I can't come up with a good signature!
- nevon
- Commander of the Circuloids
- Posts: 938
- Joined: Thu Feb 14, 2008 8:25 pm
- Location: Stockholm, Sweden
- Contact:
Re: Turning an image
The screen is cleared and drawn each frame.Anxiety wrote:But if it already is in the screen and i want to get rid of it?
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: Turning an image
Here's an example of how to toggle the image:
And in love.update you change the status of display to false on certain conditions, or something like that.
Code: Select all
display = true
function love.draw()
if display then
love.graphics.draw(...)
end
end
I find Tau easier in some ways because if you replace the math.tau bit with 1, that's the fraction of the circle you get with the angle. But anyway, each to their own.nevon wrote:You could also do this:BlackBulletIV wrote:You could also do this:Robin wrote:In case you don't know how radians work: 0 = normal, math.pi/2 = 90°, math.pi = 180°, etc.Much easier to remember for me. (By the way, I'm using Tau from here: http://tauday.com)Code: Select all
math.tau = math.pi * 2 math.tau -- 360 deg math.tau / 2 -- 180 deg math.tau / 4 -- 90 deg
Much easier to remember for me. (Granted, your ways are much faster, but w/e)Code: Select all
math.rad(90) -- 90 deg
Who is online
Users browsing this forum: Bing [Bot] and 8 guests