I want rotate images together, around the same point, here is a example code (i think it can explain more than i)
I hope i write in the right place and sorry for may bad english.
Code: Select all
local angle = 0
local image, iWidth, iHeight;
local rotate = false;
function love.load()
image = love.graphics.newImage("/test.png");
iWidth = image:getWidth();
iHeight = image:getHeight();
end
function love.draw()
local width = love.graphics.getWidth();
local height = love.graphics.getHeight();
love.graphics.print("Press 'q' to start or stop rotating", 10 , 10);
--This is the first image
if rotate then
love.graphics.draw(image, (width/2), (height/2), angle);
else
love.graphics.draw(image, (width/2), (height/2), math.rad(0));
end
-- This is the other image with rotation.
-- I want to rotate (move?) this and the first image together.
-- (Around the center of the screen, with the same distance)
love.graphics.draw(image, (width/2), (height/2) + (iHeight), math.rad(45));
end
function love.update(dt)
love.timer.sleep(.01)
angle = angle + dt * math.pi/2
angle = angle % (2*math.pi)
if love.keyboard.isDown("q") then
rotate = not rotate
end
end