The wiki did not give a straight answer, and I was somewhat confused.
Let say I made a image move along the screen if a key isDown, but I wanted it to rotate on turns
How would I rotate the image?
My guess;
love.graphics.setRotation()-- angle here?
If this is not correct, please correct it for me.
Thank you!
Rotation?
Re: Rotation?
If you have a picture...
With r being the rotation, in radians.
Otherwise, do this:
Code: Select all
love.graphics.draw( drawable, x, y, r, sx, sy, ox, oy, kx, ky )
Otherwise, do this:
Code: Select all
function love.draw()
love.graphics.push()
love.graphics.rotate( r ) -- Being the same thing as before.
-- Draw stuff.
-- Note you don't have to indent, just personal preference.
love.graphics.pop()
end
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
Re: Rotation?
What does this mean?
x, y, r, sx, sy, ox, oy, kx, ky )
I know what the r is, but what does the rest mean?
Also, do you need the code above to have all of those letters or can it be anything of your choice?
x, y, r, sx, sy, ox, oy, kx, ky )
I know what the r is, but what does the rest mean?
Also, do you need the code above to have all of those letters or can it be anything of your choice?
Re: Rotation?
from https://www.love2d.org/wiki/love.graphics.drawnumber x (default: 0)
The position to draw the object (x-axis).
number y (default: 0)
The position to draw the object (y-axis).
number r (default: 0)
Orientation (radians).
number sx (default: 1)
Scale factor (x-axis).
number sy (default: sx)
Scale factor (y-axis).
number ox (default: 0)
Origin offset (x-axis).
number oy (default: 0)
Origin offset (y-axis).
number kx (default: 0)
Shearing factor (x-axis).
number ky (default: 0)
Shearing factor (y-axis).
Re: Rotation?
If you only need X and Y then you dont need to type the rest. But if you need ox then you cant skip anything that is BEFORE ox, but you can still skip everything that is AFTER. You obviously replace the letters with the approprate thing.Findo777 wrote:What does this mean?
x, y, r, sx, sy, ox, oy, kx, ky )
I know what the r is, but what does the rest mean?
Also, do you need the code above to have all of those letters or can it be anything of your choice?
So you dont type (x,y,r) but rather (200, 132, math.pi / 2)
Who is online
Users browsing this forum: No registered users and 2 guests