General discussion about LÖVE, Lua, game development, puns, and unicorns.
Anxiety
Prole
Posts: 49 Joined: Sat Apr 02, 2011 9:36 am
Location: Finland
Post
by Anxiety » Fri Apr 08, 2011 8:03 pm
Title says it all. How can i turn an image?
PS: I just realised this is the 666th thread
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:
Post
by nevon » Fri Apr 08, 2011 8:46 pm
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:
Post
by Robin » Fri Apr 08, 2011 9:09 pm
In case you don't know how radians work: 0 = normal, math.pi/2 = 90°, math.pi = 180°, etc.
BlackBulletIV
Inner party member
Posts: 1261 Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:
Post
by BlackBulletIV » Sat Apr 09, 2011 9:16 am
Robin wrote: In case you don't know how radians work: 0 = normal, math.pi/2 = 90°, math.pi = 180°, etc.
You could also do this:
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. (By the way, I'm using Tau from here:
http://tauday.com )
nevon
Commander of the Circuloids
Posts: 938 Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:
Post
by nevon » Sat Apr 09, 2011 9:42 am
BlackBulletIV wrote: Robin wrote: In case you don't know how radians work: 0 = normal, math.pi/2 = 90°, math.pi = 180°, etc.
You could also do this:
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. (By the way, I'm using Tau from here:
http://tauday.com )
You could also do this:
Much easier to remember for me. (Granted, your ways are much faster, but w/e)
Anxiety
Prole
Posts: 49 Joined: Sat Apr 02, 2011 9:36 am
Location: Finland
Post
by Anxiety » Sat Apr 09, 2011 12:52 pm
Oh thanks. Now just one thing yet, how can i toggle image visibility?
I can't come up with a good signature!
thelinx
The Strongest
Posts: 857 Joined: Fri Sep 26, 2008 3:56 pm
Location: Sweden
Post
by thelinx » Sat Apr 09, 2011 1:19 pm
Just don't draw it.
Anxiety
Prole
Posts: 49 Joined: Sat Apr 02, 2011 9:36 am
Location: Finland
Post
by Anxiety » Sat Apr 09, 2011 3:43 pm
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:
Post
by nevon » Sat Apr 09, 2011 4:14 pm
Anxiety wrote: But if it already is in the screen and i want to get rid of it?
The screen is cleared and drawn each frame.
BlackBulletIV
Inner party member
Posts: 1261 Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:
Post
by BlackBulletIV » Sat Apr 09, 2011 8:15 pm
Here's an example of how to toggle the image:
Code: Select all
display = true
function love.draw()
if display then
love.graphics.draw(...)
end
end
And in love.update you change the status of display to false on certain conditions, or something like that.
nevon wrote: BlackBulletIV wrote: Robin wrote: In case you don't know how radians work: 0 = normal, math.pi/2 = 90°, math.pi = 180°, etc.
You could also do this:
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. (By the way, I'm using Tau from here:
http://tauday.com )
You could also do this:
Much easier to remember for me. (Granted, your ways are much faster, but w/e)
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.
Users browsing this forum: Bing [Bot] and 38 guests