screen.drawRotaion does exactly that. It rotates the object by a given angle.
update = function()
angle += 1
end
draw = function()
screen.clear()
screen.setDrawRotation( angle )
screen.drawSprite("icon", 50, 50, 20, 20 )
screen.drawSprite("icon", -50, 50, 25, 25 )
screen.drawSprite("icon", 50, -50, 30, 30 )
screen.drawSprite("icon", -50, -50, 35, 35 )
screen.drawSprite("icon", 0, 0, 40, 20 )
end
If you want to change the coordinates, you have to calculate them using trugonometric functions.
update = function()
angle += 1
end
// drawing after rotation around the axis
daraa = function( centerAxisX, centerAxisY, rX, rY, angle )
local x = centerAxisX + cosd( angle ) * rX
local y = centerAxisY + sind( angle ) * rY
screen.drawSprite( "icon", x, y, 10, 10 )
end
draw = function()
screen.clear()
screen.setDrawRotation( angle )
screen.drawSprite("icon", 50, 50, 20, 20 )
screen.drawSprite("icon", -50, 50, 25, 25 )
screen.drawSprite("icon", 50, -50, 30, 30 )
screen.drawSprite("icon", -50, -50, 35, 35 )
screen.drawSprite("icon", 0, 0, 40, 20 )
daraa( 0, 0, 100, 100 , angle )
daraa( 50, 50, 25, 25 , angle )
daraa( -50, 50, 25, 25 , -angle )
daraa( -50, -50, 25, 125 , angle )
end