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 .
Fr3@k
Prole
Posts: 1 Joined: Wed Sep 22, 2010 4:42 pm
Post
by Fr3@k » Wed Sep 22, 2010 4:47 pm
Hey,
i want just to rotate an image but i only was sucessful to rotate the image around a point...
i want it to rotate itself. do you know what i mean?
e.g.:
to
(This is an Image
)
Any idea?
EDIT///
And one question:
Is löve just a language for "minigames" or is it possible to create complex games with it?
MFG
Fr3@k
PS.:
Sorry for my Englisch
<-- German
TechnoCat
Inner party member
Posts: 1611 Joined: Thu Jul 30, 2009 12:31 am
Location: Milwaukee, WI
Contact:
Post
by TechnoCat » Wed Sep 22, 2010 5:21 pm
love.graphics.draw( drawable, x, y, r, sx, sy, ox, oy )
The r in the function is the rotation om radians.
Code: Select all
love.graphics.draw(image,x,y,math.pi)
Or if you are trying to flip the image without rotating, use the scale parameters.
Code: Select all
love.graphics.draw(image,x,y,0,1,-1)
Last edited by
TechnoCat on Wed Sep 22, 2010 5:26 pm, edited 2 times in total.
nevon
Commander of the Circuloids
Posts: 938 Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:
Post
by nevon » Wed Sep 22, 2010 5:24 pm
Löve is a game development framework. Lua is the language used. And sure, you can make complex games using Löve, if you have the skills.
To rotate an image around itself, you have to set the horizontal and vertical offsets to half the image's width/height. So if you have an image that's 32px wide and 64px tall, and you want to rotate it 90 degrees "around itself" you'd do:
Code: Select all
love.graphics.draw(image, X, Y, math.deg(90), 1, 1, 16, 32)
TechnoCat
Inner party member
Posts: 1611 Joined: Thu Jul 30, 2009 12:31 am
Location: Milwaukee, WI
Contact:
Post
by TechnoCat » Wed Sep 22, 2010 5:26 pm
nevon wrote: To rotate an image around itself, you have to set the horizontal and vertical offsets to half the image's width/height. So if you have an image that's 32px wide and 64px tall, and you want to rotate it 90 degrees "around itself" you'd do:
Code: Select all
love.graphics.draw(image, X, Y, math.deg(90), 1, 1, 16, 32)
This can be even further elaborated with
Code: Select all
love.graphics.draw(image, X, Y, math.deg(90), 1, 1, image:getWidth()/2, image:getHeight()/2)
rude
Administrator
Posts: 1052 Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway
Post
by rude » Sat Oct 02, 2010 8:35 am
Shouldn't that be math.rad (90)?
kikito
Inner party member
Posts: 3153 Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:
Post
by kikito » Sat Oct 02, 2010 11:53 pm
If up has to become down and viceversa, then I think that's 180 degrees, not 90
When I write def I mean function .
Robin
The Omniscient
Posts: 6506 Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:
Post
by Robin » Sun Oct 03, 2010 12:02 am
I don't think you're all helping the poor fellow understand all this.
What TechnoCat said first is the best way, I think:
TechnoCat wrote: love.graphics.draw( drawable, x, y, r, sx, sy, ox, oy )
The r in the function is the rotation om radians.
Code: Select all
love.graphics.draw(image,x,y,math.pi)
Or if you are trying to flip the image without rotating, use the scale parameters.
Code: Select all
love.graphics.draw(image,x,y,0,1,-1)
TechnoCat
Inner party member
Posts: 1611 Joined: Thu Jul 30, 2009 12:31 am
Location: Milwaukee, WI
Contact:
Post
by TechnoCat » Sun Oct 03, 2010 12:15 am
I feel like a bumbling idiot looking back at my posts.
Rotating:
math.rad(180) = math.pi
Scaling:
-1
Users browsing this forum: Bing [Bot] , Google [Bot] and 3 guests