+When you want
-> tiledBg: set position to choose(-1,1),choose(-1,1)
-> tiledBg: set angle to angle(0,0,self.X,self.Y)+135
-> tiledBg: set position to clamp(self.X,0,1)*layoutWidth,clamp(self.Y,0,1)*layoutHeight
should work (:
Explanation:
Let's look each of these 3 actions one by one
1/ basically the first action gives you this kind of possible result:
(-1,-1)
(1,-1)
(1,1)
(-1,1)
2/ If you draw these points on a graph you'll notice that angles from origin to these points are multiple of 45...
But the most important, these 4 possibilities are 90 degrees appart and in a proper order.
So by adding 135 you end up with somthing like :
angle(0,0,-1,-1)=-135 -> -135 + 135 = 0
angle(0,0,1,-1)=-45 -> -45 + 135 = 90
angle(0,0,1,1)=45 -> 45 + 135 = 180
angle(0,0,-1,1)=135 -> 135 + 135 = 270
3/ And then if you clamp at min 0 max 1 these kind of value you end up with
(0,0)
(1,0)
(1,1)
(0,1)
you then just have to multiply these value by (layoutWidth,layoutHeight)