Image rotation

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
Arthes
Prole
Posts: 10
Joined: Fri Dec 30, 2011 10:52 am

Image rotation

Post by Arthes »

Hello.
How to rotate the image created by love.graphics.newImage()?
Very thanks for replies.
User avatar
Jack
Prole
Posts: 10
Joined: Sat Jan 07, 2012 5:01 am

Re: Image rotation

Post by Jack »

If you are only drawing one image...

Code: Select all

function love.draw()

love.graphics.rotate(angleInRadians) -- Rotates all items drawn.
love.graphics.draw(yourImage,x,y)  -- Draws your image.

end
To convert an angle to radian, you can use...

Code: Select all

radian = angle*math.pi/180
When you use this it rotates from 0,0 not your image's x,y so you have to compensate. Is that what you meant?
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Image rotation

Post by Jasoco »

Well, if you have more than one image, you use the image's rotation parameter itself.

Code: Select all

love.graphics.draw(image, x, y, rotation_in_radians, scale_x, scale_y, offset_x, offset_y)
Post Reply

Who is online

Users browsing this forum: No registered users and 186 guests