No because randomly putting a random angle won't fix the issue becuase since the position is also random it may not end in the right angle.. I need the hostpot in the top-left corner because I'm using sine to make it grow an reduce it for a special effect.

could help to have at least some visual to be sure but let see

if you're on :

top left (0,0) angle should be 0

top right (layoutwidth,0) angle should be 90

bottom right (layoutwidth,layoutheight) angle should be 180

bottom left (0,layoutheight) angle should be 270

so then hmmm I see

+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)