Setting A Circle's Rotation From A Changing Number in the BGE I have a timer that counts from 82 to -82 and back.
And I have a circle that should rotate (x rotation) from 82 to -82 and back.

How can I assign the timer number to the x rotation number of the circle?

My code so far is:

cont = bge.logic.getCurrentController()

circle = cont.owner

matrix_rotation = circle.worldOrientation

euler_rotation = matrix_rotation.to_euler()

degrees_rotation = [math.degrees(a) for a in euler_rotation]

circleRotation = int(degrees_rotation[1])


Now I want to reverse the steps but don't know how to do it. The timer is driven by the system time and the circle should spin accordingly (it is kind of a skybox).
All your need to do is take your timer's output (the timer var in my script), convert it to radians and then insert it in the object rotation vector.

import bge
import math

cont = bge.logic.getCurrentController()
circle = cont.owner

x = math.radians(timmer)
circle.worldOrientation = (x, 0.0, 0.0)


The reason for the math.radians() conversion is worldOrientation is a vector storing the rotation for the X, Y and Z axes in radians.



As a side note, a much simpler way to get the rotation of a object in degrees  is with these two lines. I used the same variable names you did to make it easier to see where it would fit in.

euler_rotation = circle.worldOrientation.to_euler()
circleRotation = math.degrees(euler_rotation[0])