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?
Please, help beginning LOVEr
-
- Prole
- Posts: 3
- Joined: Sun Sep 15, 2013 8:43 am
- Location: Almaty
Re: Please, help beginning LOVEr
Use the offset values of love.graphics.draw/love.graphics.drawq
eg:
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.
eg:
Code: Select all
love.graphics.drawq(img,quad,x,y,rot,1,1,img:getWidth()/2,img:getHeight()/2)
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.
Your screen is very zoomed in...
-
- Prole
- Posts: 3
- Joined: Sun Sep 15, 2013 8:43 am
- Location: Almaty
Re: Please, help beginning LOVEr
Thank you very much!
It works!
It works!
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 4 guests