Page 1 of 1

Please, help beginning LOVEr

Posted: Wed Oct 02, 2013 6:16 pm
by klepikovmd
Hello everybody!
I am beginning LOVEr and now i am making my first game, a space shooter. When i am drawing a quad with rotation angle, center of rotation is bottom-left corner. How can i rotate around center of the quad?

Re: Please, help beginning LOVEr

Posted: Wed Oct 02, 2013 8:08 pm
by mickeyjm
Use the offset values of love.graphics.draw/love.graphics.drawq
eg:

Code: Select all

love.graphics.drawq(img,quad,x,y,rot,1,1,img:getWidth()/2,img:getHeight()/2)
The 1,1, bit is just the scale, I set it to 1 so there would be no difference (assuming you dont use it already in drawq).
The img:getWidth()/2 moves the rotated image by half the image width across, same with the height. This effectively rotates the image around the centre.

Re: Please, help beginning LOVEr

Posted: Wed Oct 02, 2013 8:35 pm
by klepikovmd
Thank you very much!
It works!